Publisher 2013

 Copy code hover
[image]

Publisher 2013
Send feedback

Publisher product logo

Use Publisher 2013 to create professional-looking publications quickly and easily.

Explore Publisher 2013 developer resources

Get started

Get started

Publisher for developers

References

Reference

Publisher 2013 developer reference

Find training and other resources about Office

Email us to suggest content Subscribe to the Office developer RSS Read Office developer blogs Read Office developer forums Visit MSDN Office and SharePoint on Facebook Follow @MSDN_Office on Twitter

Download

Office updates

Office 365

Office code samples

Office scripts and sample files

Office downloads

Office 365 downloads

How To

Train Office 2010 end users

Office developer videos

Office IT pro training

Office IT pro videos

Sites

Office 365 IT pros

Office 2013 Resource Kit

SharePoint developers

SharePoint IT pros

Office.com

Microsoft.com: Office 365

Additional resources

  • Access 2013

  • Excel 2013

  • InfoPath 2013

  • Office 2013

  • OneNote 2013

  • Outlook 2013

  • PowerPoint 2013

  • Project 2013

  • SharePoint 2013

  • Visio 2013

  • Word 2013

© 2013 Microsoft Corporation. All rights reserved.


FillFormat Object (Publisher)

 Copy code hover
[image]

FillFormat Object (Publisher)
Send feedback

Represents fill formatting for a shape. A shape can have a solid, gradient, texture, pattern, picture, or semitransparent fill.

Remarks

Many of the properties of the FillFormat object are read-only. To set one of these properties, you have to apply the corresponding method.

Example

Use the Fill property to return a FillFormat object. The following example adds a shape to the active document and then sets the gradient and color for the shape's fill.

Copy code Copy code
Sub AddShapeAndSetFill()
 With ActiveDocument.Pages(1).Shapes.AddShape(Type:=msoShapeHeart, _
 Left:=90, Top:=90, Width:=90, Height:=80).Fill
 .ForeColor.RGB = RGB(Red:=255, Green:=0, Blue:=0)
 .OneColorGradient Style:=msoGradientHorizontal, _
 Variant:=1, Degree:=1
 End With
End Sub


WebCommandButton.ButtonText Property (Publisher)

 Copy code hover
[image]

WebCommandButton.ButtonText Property (Publisher)
Send feedback

Returns or sets a String that represents the text that appears on the face of a Web command button. Read/write.

Syntax

expression .ButtonText

expression A variable that represents a WebCommandButton object.

Return Value

String

Example

This example creates a new Web command button, assigns text to appear on its face, and specifies an e-mail address to which to send the form data.

Copy code Copy code
Sub NewWebForm()
 With ActiveDocument.Pages.Add(Count:=1, After:=1)
 With .Shapes.AddWebControl(Type:=pbWebControlCommandButton, _
 Left:=72, Top:=72, Width:=72, Height:=36)
 With .WebCommandButton
 .ButtonType = pbCommandButtonSubmit
 .ButtonText = "Send Form:"
 .EmailAddress = "someone@example.com"
 End With
 End With
 End With
End Sub


PictureFormat.TransparentBackground Property (Publisher)

 Copy code hover
[image]

PictureFormat.TransparentBackground Property (Publisher)
Send feedback

Indicates whether the parts of the specified picture that are defined as the transparent color appear transparent. Read/write.

Syntax

expression .TransparentBackground

expression A variable that represents a PictureFormat object.

Return Value

MsoTriState

Remarks

The TransparentBackground property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | Parts of the picture whose color is the transparency color do not appear transparent.
msoTriStateMixed | Return value only, indicating a combination of msoTrue and msoFalse for the specified objects..
msoTriStateToggle | Set value that switches between msoTrue and msoFalse.
msoTrue | Parts of the picture whose color is the transparency color appear transparent.

Use the TransparencyColor property to set the transparent color.

This property applies only to bitmaps.

If you want to be able to see through the transparent parts of the picture all the way to the objects behind the picture, you must set the Visible property of the picture's FillFormat object to mso False. If your picture has a transparent color and the Visible property of the picture's FillFormat object is set to msoTrue, the picture's fill is visible through the transparent color, but objects behind the picture are obscured.

Example

This example sets the color blue as the transparent color for shape one in the active publication. For the example to work, shape one must be a bitmap.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes(1)

 With .PictureFormat
 .TransparentBackground = msoTrue
 ' RGB(0, 0, 255) is the color blue.
 .TransparencyColor = RGB(0, 0, 255)
 End With

 .Fill.Visible = False

End With


Shape.BlackWhiteMode Property (Publisher)

 Copy code hover
[image]

Shape.BlackWhiteMode Property (Publisher)
Send feedback

Returns or sets an MsoBlackWhiteMode constant indicating how the specified shape or shape range appears when the publication is viewed in black-and-white mode. Read/write.

Syntax

expression .BlackWhiteMode

expression A variable that represents a Shape object.

Remarks

The BlackWhiteMode property value can be one of the MsoBlackWhiteMode constants declared in the Microsoft Office type library.

Example

This example sets the first shape in the active publication to appear in black-and-white mode. When you view the publication in black-and-white mode, the shape will appear black, regardless of what color it is in color mode.

VBA Copy code Copy code
ActiveDocument.Pages(1).Shapes(1).BlackWhiteMode = msoBlackWhiteBlack


WebOptions.Encoding Property (Publisher)

 Copy code hover
[image]

WebOptions.Encoding Property (Publisher)
Send feedback

Returns an MsoEncoding constant that specifies the encoding of the Web publication. Read/write.

Syntax

expression .Encoding

expression A variable that represents an WebOptions object.

Return Value

MsoEncoding

Remarks

If the AlwaysSaveInDefaultEncoding property is set to True on a given WebOptions object, any subsequent attempts to set the Encoding property on that object will be ignored.

Attempting to set the Encoding property to an MsoEncoding constant that is not available on the client computer results in a run-time error.

The Encoding property value can be one of the MsoEncoding constants declared in the Microsoft Office type library.

Example

The following example tests whether the Web publication is currently set to be saved using default encoding. If so, the AlwaysSaveInDefaultEncoding property is set to False, and the Encoding property is used to set the encoding to Unicode (UTF-8).

VBA Copy code Copy code
Dim theWO As WebOptions

Set theWO = Application.WebOptions

With theWO
 If .AlwaysSaveInDefaultEncoding = True Then
 .AlwaysSaveInDefaultEncoding = False
 .Encoding = msoEncodingUTF8
 End If
End With


PageSetup.Parent Property (Publisher)

 Copy code hover
[image]

PageSetup.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a PageSetup object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


MailMergeFilterCriterion.Column Property (Publisher)

 Copy code hover
[image]

MailMergeFilterCriterion.Column Property (Publisher)
Send feedback

Returns a String that represents the name of the field in the mail merge data source to use in the filter. Read/write.

Syntax

expression .Column

expression A variable that represents a MailMergeFilterCriterion object.

Example

The following example changes an existing filter to remove from the mail merge all records that do not have a Region field equal to "WA".

VBA Copy code Copy code
Sub SetQueryCriterion()
 Dim intItem As Integer
 With ActiveDocument.MailMerge.DataSource.Filters
 For intItem = 1 To .Count
 With .Item(intItem)
 If .Column = "Region" Then
 .Comparison = msoFilterComparisonNotEqual
 .CompareTo = "WA"
 If .Conjunction = "Or" Then .Conjunction = "And"
 End If
 End With
 Next intItem
 End With
End Sub


Shape.Width Property (Publisher)

 Copy code hover
[image]

Shape.Width Property (Publisher)
Send feedback

Returns or sets a Variant that represents the width (in points) of a specified table column or shape. Read/write.

Syntax

expression .Width

expression A variable that represents a Shape object.


TextEffectFormat.PresetWordArt Property (Publisher)

 Copy code hover
[image]

TextEffectFormat.PresetWordArt Property (Publisher)
Send feedback

A pbPresetWordArt constant that indicates the type of preset WordArt associated with the specified object. Read/write.

Version Information

Version Added: Publisher 2010

Syntax

expression .PresetWordArt

expression A variable that represents a TextEffectFormat object.


AdvancedPrintOptions.PrintCropMarks Property (Publisher)

 Copy code hover
[image]

AdvancedPrintOptions.PrintCropMarks Property (Publisher)
See also Send feedback

True to print crop marks for the specified publication. The default is True. Read/write Boolean.

Syntax

expression .PrintCropMarks

expression A variable that represents a AdvancedPrintOptions object.

Return Value

Boolean

Remarks

This property corresponds to the Crop marks control on the Page Settings tab of the Advanced Print Settings dialog box.

Crop marks are used as guides when a printed publication is trimmed to its intended size.

These printer's marks print outside the publication and can only be printed if the size of the sheet being printed to is larger than the publication page size.

Example

The following example sets crop marks and job information to print with the publication. If the publication is printed as separations, the additional types of printer's marks are also set to print. This example assumes that the size of the paper being printed to is larger than the publication page size.

VBA Copy code Copy code
Sub SetPrintersMarksToPrint()
 With ActiveDocument.AdvancedPrintOptions
 .PrintCropMarks = True
 .PrintJobInformation = True
 If PrintMode = pbPrintModeSeparations Then
 .PrintRegistrationMarks = True
 .PrintDensityBars = True
 .PrintColorBars = True
 End If
 End With
End Sub

See also

Concepts

AdvancedPrintOptions Object

Other resources

AdvancedPrintOptions Object Members


WebListBox Object (Publisher)

 Copy code hover
[image]

WebListBox Object (Publisher)
Send feedback

Represents a Web list box control. The WebListBox object is a member of the Shape object.

Example

Use the AddWebControl method to create a new Web list box. Use the WebListBox property to access a Web list box control shape. Use the AddItem method of the WebListBoxItems object to add items to a Web list box. This example creates a new Web list box and adds several items to it. Note that when initially created, a Web list box control contains three default items. This example includes a routine that deletes the default list box items before adding new items.

Note Note

When you create a Web list box, its initial width is 300 points. However, Microsoft Publisher automatically changes this width based on the width of the items in the list.
Copy code Copy code
Sub CreateWebListBox()
 Dim intCount As Integer
 With ActiveDocument.Pages(1).Shapes
 With .AddWebControl(Type:=pbWebControlListBox, Left:=100, _
 Top:=150, Width:=300, Height:=72).WebListBox
 .MultiSelect = msoFalse
 With .ListBoxItems
 For intCount = 1 To .Count
 .Delete (1)
 Next
 .AddItem Item:="Green"
 .AddItem Item:="Purple"
 .AddItem Item:="Red"
 .AddItem Item:="Black"
 End With
 End With
 End With
End Sub


Page.PageType Property (Publisher)

 Copy code hover
[image]

Page.PageType Property (Publisher)
Send feedback

Returns a PbPageType constant that represents the page type. Read-only.

Syntax

expression .PageType

expression A variable that represents a Page object.

Return Value

PbPageType

Remarks

The PageType property value can be one of the following PbPageType constants declared in the Microsoft Publisher type library.

pbPageLeftPage

pbPageMasterPage

pbPageRightPage

pbPageScratchPage

Example

This example adds a shape on alternating corners of each page in the active publication.

VBA Copy code Copy code
Sub GetPageType()
 Dim pgCount As Page
 For Each pgCount In ActiveDocument.Pages
 If pgCount.PageType = pbPageLeftPage Then
 pgCount.Shapes.AddShape Type:=msoShapeOval, _
 Left:=50, Top:=50, Width:=50, Height:=50
 ElseIf pgCount.PageType = pbPageRightPage Then
 pgCount.Shapes.AddShape Type:=msoShapeOval, _
 Left:=512, Top:=50, Width:=50, Height:=50
 End If
 Next
End Sub


ShapeRange.SaveAsPicture Method (Publisher)

 Copy code hover
[image]

ShapeRange.SaveAsPicture Method (Publisher)
Send feedback

Saves a range of one or more shapes as a picture file.

Version Information

Version Added: Publisher 2007

Syntax

expression .SaveAsPicture(Filename, pbResolution)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | The path and file name of the new picture file you want to create. The graphics format the picture is saved in is determined by the file name extension (such as .jpg or .gif) you specify.
pbResolution | Optional | PbPictureResolution | The resolution in which you want the picture to be saved. See Remarks for possible values.

Remarks

Possible values for the pbResolution parameter are declared in the PbPictureResolution enumeration in the Microsoft Publisher type library.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the SaveAsPicture method to save all the shapes on the first page of the active publication as a .jpg picture file.

Before running this code, replace filename.jpg with a valid file name and the path to a folder on your computer where you have permission to save files.

VBA Copy code Copy code
Public Sub SaveAsPicture_Example()

 Dim pubShapeRange As Publisher.ShapeRange
 Set pubShapeRange = ThisDocument.Pages(1).Shapes.Range

 pubShapeRange.SaveAsPicture "filename.jpg"

End Sub


ShapeRange.Vertices Property (Publisher)

 Copy code hover
[image]

ShapeRange.Vertices Property (Publisher)
Send feedback

Returns the coordinates of the specified freeform drawing's vertices (and control points for Bézier curves) as a series of coordinate pairs. Read-only Variant.

Syntax

expression .Vertices

expression A variable that represents a ShapeRange object.

Remarks

You can use the array returned by this property as an argument to the AddCurve or AddPolyline methods.

The following table shows how the Vertices property associates the values in the array vertArray() with the coordinates of a triangle's vertices.

vertArray element | Contains
vertArray(1, 1) | The horizontal distance from the first vertex to the left side of the page.
vertArray(1, 2) | The vertical distance from the first vertex to the top of the page.
vertArray(2, 1) | The horizontal distance from the second vertex to the left side of the page.
vertArray(2, 2) | The vertical distance from the second vertex to the top of the page.
vertArray(3, 1) | The horizontal distance from the third vertex to the left side of the page.
vertArray(3, 2) | The vertical distance from the third vertex to the top of the page.

Example

This example assigns the vertex coordinates for shape one in the active publication to the array variable vertArray() and displays the coordinates for the first vertex.

Copy code Copy code
Dim vertArray As Variant
Dim sngX1 As Single
Dim sngY1 As Single

With ActiveDocument.Pages(1).Shapes(1)
 vertArray = .Vertices
 sngX1 = vertArray(1, 1)
 sngY1 = vertArray(1, 2)
 MsgBox "First vertex coordinates: " & sngX1 & ", " & sngY1
End With

This example creates a curve that has the same geometric description as shape one in the active publication. Shape one must contain 3n+1 vertices for this example to work, where n is an integer greater than or equal to 1.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes
 .AddCurve SafeArrayOfPoints:=.Item(1).Vertices
End With


PictureFormat.OriginalHeight Property (Publisher)

 Copy code hover
[image]

PictureFormat.OriginalHeight Property (Publisher)
Send feedback

Returns a Variant representing the height, in points, of the specified linked picture or OLE object. Read-only.

Syntax

expression .OriginalHeight

expression A variable that represents an PictureFormat object.

Return Value

Variant

Remarks

This property applies only to linked pictures or OLE objects. Returns "Permission Denied" for shapes representing embedded or pasted pictures.

To determine whether a shape represents a linked picture, use either the Type property of the Shape object, or the IsLinked property of the PictureFormat object.

Example

The following example tests each picture in the active publication, and returns selected image properties for pictures that are linked.

VBA Copy code Copy code
Dim pgLoop As Page
Dim shpLoop As Shape

For Each pgLoop In ActiveDocument.Pages
 For Each shpLoop In pgLoop.Shapes
 If shpLoop.Type = pbLinkedPicture Then

 With shpLoop.PictureFormat

 Debug.Print "File Name: " & .Filename
 Debug.Print "Horizontal Scaling: " & .HorizontalScale & "%"
 Debug.Print "Original Image Height: " & .OriginalHeight & " points"
 Debug.Print "Height in publication: " & .Height & " points"

 End With
 End If
 Next shpLoop
Next pgLoop


WebNavigationBarSets Object (Publisher)

 Copy code hover
[image]

WebNavigationBarSets Object (Publisher)
Send feedback

A collection of all the WebNavigationBarSet objects in the current document. Each WebNavigationBarSet represents a Web navigation bar set consisting of hyperlinks.

Remarks

By default there are two WebNavigationBarSet objects on each Web wizard page; one is text-only and the other is vertical. These objects correspond to the design of the wizard regardless of whether or not a navigation bar is used on the page.

Example

Use the WebNavigationBarSets property of the current document to return a WebNavigationBarSet object. The following example sets an object variable to the WebNavigationBarSets collection of the active document.

Copy code Copy code
Dim objWebNavBarSets As WebNavigationBarSets
Set objWebNavBarSets = ActiveDocument.WebNavigationBarSets

Use WebNavigationBarSets.Item(index), where index is the index number, to return a WebNavigationBarSet object from the collection. The following example returns the first Web navigation bar set from the WebNavigationBarSets collection.

Copy code Copy code
Dim objWebNavBarSet As WebNavigationBarSet
Set objWebNavBarSet = ActiveDocument.WebNavigationBarSets.Item(1)

The previous example can also be accomplished using WebNavigationBarSets(index), where index is the index number, to return a WebNavigationBarSet object.

Copy code Copy code
Dim objWebNavBarSet As WebNavigationBarSet
Set objWebNavBarSet = ActiveDocument.WebNavigationBarSets(1)

The previous example can also be accomplished using WebNavigationBarSets(index) where index is a string indicating the name of the Web navigation bar set to return.

Copy code Copy code
Dim objWebNavBarSet As WebNavigationBarSet
Set objWebNavBarSet = ActiveDocument.WebNavigationBarSets("WebNavBarSet1")

Use WebNavigationBarSets.Count to return the number of Web navigation bar sets in the collection. This example displays the number of Web navigation bar sets in the current document.

Copy code Copy code
MsgBox ActiveDocument.WebNavigationBarSets.Count

Use WebNavigationBarSets.AddToEveryPage(Left, Top, [Width]), where Left is the distance from the left of the page to the left edge of the navigation bar, Top is the distance form the top of the page to the top edge of the navigation bar, and Width is the width of the navigaion bar, to add the specified navigation bar to every page. The following example adds the navigation bar named "WebNavBar1" to every page in the current publication.

Copy code Copy code
ActiveDocument.WebNavigationBarSets.Item _
 ("WebNavBarSet1").AddToEveryPage _
 Left:=50, Top:=25


pbPictureInsertFit Enumeration (Publisher)

 Copy code hover
[image]

pbPictureInsertFit Enumeration (Publisher)
Send feedback

Insert introduction here.

Section heading

Insert section body here.

Subsection heading

Insert subsection body here.


WebListBox.ReturnDataLabel Property (Publisher)

 Copy code hover
[image]

WebListBox.ReturnDataLabel Property (Publisher)
Send feedback

Returns or sets a String that represents the text used by the Web page to label the specified Web object when the page is submitted. Read/write.

Syntax

expression .ReturnDataLabel

expression A variable that represents a WebListBox object.

Example

This example creates a new Web text box and specifies the label for the text in the text box when the page is submitted.

Copy code Copy code
Sub LabelWebTextBoxControl()
 With ActiveDocument.Pages(1).Shapes _
 .AddWebControl(Type:=pbWebControlSingleLineTextBox, _
 Left:=100, Top:=100, Width:=300, Height:=15).WebTextBox
 .DefaultText = "Please enter your name here"
 .Limit = 70
 .RequiredControl = msoTrue
 .ReturnDataLabel = "Full_Name"
 End With
End Sub


AdvancedPrintOptions.AllowBleeds Property (Publisher)

 Copy code hover
[image]

AdvancedPrintOptions.AllowBleeds Property (Publisher)
See also Send feedback

True to allow bleeds to print for the specified publication. The default is True. Read/write Boolean.

Syntax

expression .AllowBleeds

expression A variable that represents an AdvancedPrintOptions object.

Return Value

Boolean

Remarks

When bleeds are allowed, objects that are partially off the page print to one eighth inch outside the defined page size.

If you allow bleeds in a document, you can specify whether bleed marks are printed by using the PrintBleedMarks property of the AdvancedPrintOptions object.

This property corresponds to the Allow bleeds control on the Page Settings tab of the Advanced Print Settings dialog box.

Example

The following example sets the publication to allow bleeds, and to print bleed marks.

Copy code Copy code
Sub AllowBleedsAndPrintMarks()
 With ActiveDocument.AdvancedPrintOptions
 .AllowBleeds = True
 .PrintBleedMarks = True
 End With
End Sub

See also

Concepts

AdvancedPrintOptions Object

Other resources

AdvancedPrintOptions Object Members


PbPageNumberFormat Enumeration (Publisher)

 Copy code hover
[image]

PbPageNumberFormat Enumeration (Publisher)
Send feedback

Reperesents the formatting of the page numbering.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbPageNumberFormatAiueo | 12 | Aiueo
pbPageNumberFormatArabic | 0 | Arabic
pbPageNumberFormatArabic1 | 46 | Arabic1
pbPageNumberFormatArabic2 | 48 | Arabic2
pbPageNumberFormatArabicLZ | 22 | ArabicLZ
pbPageNumberFormatCardtext | 6 | Cardtext
pbPageNumberFormatChnDbNum2 | 38 | ChnDbNum2
pbPageNumberFormatChnDbNum3 | 39 | ChnDbNum3
pbPageNumberFormatChosung | 25 | Chosung
pbPageNumberFormatCirclenum | 18 | Circlenum
pbPageNumberFormatDAiueo | 20 | DAiueo
pbPageNumberFormatDbChar | 14 | DbChar
pbPageNumberFormatDbNum1 | 10 | DbNum1
pbPageNumberFormatDbNum2 | 11 | DbNum2
pbPageNumberFormatDbNum3 | 16 | DbNum3
pbPageNumberFormatDIroha | 21 | DIroha
pbPageNumberFormatGanada | 24 | Ganada
pbPageNumberFormatHebrew1 | 45 | Hebrew1
pbPageNumberFormatHebrew2 | 47 | Hebrew2
pbPageNumberFormatHindi1 | 49 | Hindi1
pbPageNumberFormatHindi2 | 50 | Hindi2
pbPageNumberFormatHindi3 | 51 | Hindi3
pbPageNumberFormatHindi4 | 52 | Hindi4
pbPageNumberFormatIroha | 13 | Iroha
pbPageNumberFormatKorDbNum1 | 41 | KorDbNum1
pbPageNumberFormatKorDbNum2 | 42 | KorDbNum2
pbPageNumberFormatKorDbNum3 | 43 | KorDbNum3
pbPageNumberFormatKorDbNum4 | 44 | KorDbNum4
pbPageNumberFormatLCLetter | 4 | LC Letter
pbPageNumberFormatLCRoman | 2 | LC Roman
pbPageNumberFormatLCRus | 58 | LC Rus
pbPageNumberFormatOrdinal | 5 | Ordinal
pbPageNumberFormatOrdtext | 7 | Ordtext
pbPageNumberFormatThai1 | 53 | Thai1
pbPageNumberFormatThai2 | 54 | Thai2
pbPageNumberFormatThai3 | 55 | Thai3
pbPageNumberFormatTpeDbNum2 | 34 | TpeDbNum2
pbPageNumberFormatTpeDbNum3 | 35 | TpeDbNum3
pbPageNumberFormatUCLetter | 3 | UC Letter
pbPageNumberFormatUCRoman | 1 | UC Roman
pbPageNumberFormatUCRus | 59 | UC Rus
pbPageNumberFormatViet1 | 56 | Viet 1
pbPageNumberFormatZodiac1 | 30 | Zodiac1
pbPageNumberFormatZodiac2 | 31 | Zodiac2


DropCap.Span Property (Publisher)

 Copy code hover
[image]

DropCap.Span Property (Publisher)
Send feedback

Returns or sets a Long that represents the number of letters included in the specified dropped capital letter. Read/write.

Syntax

expression .Span

expression A variable that represents a DropCap object.

Return Value

Long

Example

This example creates a custom dropped capital letter that is five lines high, spans the first three characters of the paragraphs in the text range, and is raised one line above the first line.

VBA Copy code Copy code
Sub SetDropCapSpan()
 With ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.DropCap
 .Size = 5
 .Span = 3
 .LinesUp = 1
 End With
End Sub


Hyperlink Methods (Publisher)

 Copy code hover
[image]

Hyperlink Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified object.
SetPageRelative | Sets the target type for the specified hyperlink.


DropCap.FontColor Property (Publisher)

 Copy code hover
[image]

DropCap.FontColor Property (Publisher)
Send feedback

Returns or sets a ColorFormat object that represents the color applied to a specified dropped capital letter.

Syntax

expression .FontColor

expression A variable that represents a DropCap object.

Return Value

ColorFormat

Example

This example applies an RGB color to the dropped capital letter in the specified text frame. This example assumes that the specified text frame is formatted with a dropped capital letter.

Copy code Copy code
Sub BoldDropCap()
 With ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.DropCap
 .FontBold = msoTrue
 .FontColor.RGB = RGB(Red:=150, Green:=50, Blue:=180)
 .FontItalic = msoTrue
 .FontName = "Script MT Bold"
 End With
End Sub


Shape.ConnectionSiteCount Property (Publisher)

 Copy code hover
[image]

Shape.ConnectionSiteCount Property (Publisher)
Send feedback

Returns a Long indicating the count of connection sites on the current Shape object. Read-only.

Syntax

expression .ConnectionSiteCount

expression A variable that represents a Shape object.

Remarks

The number of connection sites varies depending on the shape geometry. Rectangular objects including tables and Web controls will most likely have four connection sites, one centered on each edge of the shape.

Example

This example adds two rectangles to the active publication and joins them with two connectors. The beginnings of both connectors attach to connection site one on the first rectangle; the ends of the connectors attach to the first and last connection sites of the second rectangle. Then it counts the number of connections on the first rectangle.

Copy code Copy code
Sub Connections()

 Dim shpNew As Shapes
 Dim shpFirstRect As Shape
 Dim shpSecondRect As Shape
 Dim intLastSite As Integer
 Dim intCount As Integer

 Set shpNew = Application.ActiveDocument _
 .MasterPages(Item:=1).Shapes
 Set shpFirstRect = shpNew.AddShape(Type:=msoShapeRectangle, _
 Left:=100, Top:=50, Width:=200, Height:=100)
 Set shpSecondRect = shpNew.AddShape(msoShapeRectangle, _
 Left:=300, Top:=300, Width:=200, Height:=100)
 varLastSite = shpSecondRect.ConnectionSiteCount

 ' Add the first connector from rectangle 1,
 ' site 1 to rectangle 2, site 1.
 With shpNew.AddConnector(Type:=msoConnectorCurve, _
 BeginX:=0, BeginY:=0, EndX:=100, EndY:=100) _
 .ConnectorFormat
 .BeginConnect ConnectedShape:=shpFirstRect, ConnectionSite:=1
 .EndConnect ConnectedShape:=shpSecondRect, ConnectionSite:=1
 End With

 ' Add the second connector from rectangle 1,
 ' site 1 to rectangle 2, site 2.
 With shpNew.AddConnector(Type:=msoConnectorCurve, _
 BeginX:=0, BeginY:=0, EndX:=100, EndY:=100) _
 .ConnectorFormat
 .BeginConnect ConnectedShape:=shpFirstRect, ConnectionSite:=1
 .EndConnect ConnectedShape:=shpSecondRect, _
 ConnectionSite:=intLastSite
 End With

 intCount = shpFirstRect.ConnectionSiteCount

End Sub


Shape.WebOptionButton Property (Publisher)

 Copy code hover
[image]

Shape.WebOptionButton Property (Publisher)
Send feedback

Returns the WebOptionButton object associated with the specified shape.

Syntax

expression .WebOptionButton

expression A variable that represents a Shape object.

Return Value

WebOptionButton

Example

This example creates a new Web option button and specifies that its default state is selected.

VBA Copy code Copy code
Dim shpNew As Shape
Dim wobTemp As WebOptionButton

Set shpNew = ActiveDocument.Pages(1).Shapes.AddWebControl _
 (Type:=pbWebControlOptionButton, Left:=100, _
 Top:=123, Width:=16, Height:=10)

Set wobTemp = shpNew.WebOptionButton

wobTemp.Selected = msoTrue


Document.LayoutGuides Property (Publisher)

 Copy code hover
[image]

Document.LayoutGuides Property (Publisher)
Send feedback

Returns a LayoutGuides object consisting of the margin and grid layout guides for all pages including master pages in the publication.

Syntax

expression .LayoutGuides

expression A variable that represents a Document object.

Example

The following example changes the grid layout guides so that there are three columns and five rows.

Copy code Copy code
Dim layTemp As LayoutGuides

Set layTemp = ActiveDocument.LayoutGuides

With layTemp
 .Rows = 5
 .Columns = 3
End With


Sections.Item Property (Publisher)

 Copy code hover
[image]

Sections.Item Property (Publisher)
Send feedback

Returns an individual object from a specified collection. Read-only.

Syntax

expression .Item(Index)

expression A variable that represents a Sections object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The number of the object to return.


OLEFormat.Application Property (Publisher)

 Copy code hover
[image]

OLEFormat.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents an OLEFormat object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


PictureFormat.OriginalResolution Property (Publisher)

 Copy code hover
[image]

PictureFormat.OriginalResolution Property (Publisher)
Send feedback

Returns a Long that represents, in dots per inch (dpi), the resolution at which the linked picture was originally scanned. Read-only.

Syntax

expression .OriginalResolution

expression A variable that represents an PictureFormat object.

Return Value

Long

Remarks

This property only applies to linked pictures. Returns "Permission Denied" for shapes representing embedded or pasted pictures.

To determine whether a shape represents a linked picture, use either the Type property of the Shape object, or the IsLinked property of the PictureFormat object.

Use the EffectiveResolution property to determine the resolution at which the picture or OLE object prints in the specified document.

Example

The following example tests each picture in the active publication, and returns selected image properties for pictures that are linked.

VBA Copy code Copy code
Dim pgLoop As Page
Dim shpLoop As Shape

For Each pgLoop In ActiveDocument.Pages
 For Each shpLoop In pgLoop.Shapes
 If shpLoop.Type = pbLinkedPicture Then

 With shpLoop.PictureFormat

 Debug.Print "File Name: " & .Filename
 Debug.Print "Resolution in Publication: " & .EffectiveResolution & " dpi"
 Debug.Print "Original Resolution: " & .OriginalResolution & " dpi"

 End With
 End If
 Next shpLoop
Next pgLoop


TextRange.Hyperlinks Property (Publisher)

 Copy code hover
[image]

TextRange.Hyperlinks Property (Publisher)
Send feedback

Returns a Hyperlinks collection representing all the hyperlinks in the specified text range.

Syntax

expression .Hyperlinks

expression A variable that represents a TextRange object.

Return Value

Hyperlinks

Example

The following example looks for all the shapes on page one of the active publication that have text frames and reports how many hyperlinks each shape has.

Copy code Copy code
Dim hypAll As Hyperlinks
Dim shpLoop As Shape

For Each shpLoop In ActiveDocument.Pages(1).Shapes
 If shpLoop.HasTextFrame = msoTrue Then
 Set hypAll = shpLoop.TextFrame.TextRange.Hyperlinks
 Debug.Print "Shape " & shpLoop.Name _
 & " has " & hypAll.Count & " hyperlinks."
 End If
Next shpLoop


Document.ActiveWindow Property (Publisher)

 Copy code hover
[image]

Document.ActiveWindow Property (Publisher)
Send feedback

Returns a Window object that represents the window with the focus. Because Microsoft Publisher only has one window, there is only one Window object to return.

Syntax

expression .ActiveWindow

expression A variable that represents a Document object.

Example

This example displays the active window's caption.

Copy code Copy code
Sub CurrentCaption()

 MsgBox ActiveDocument.ActiveWindow.Caption

End Sub


Hyperlinks Methods (Publisher)

 Copy code hover
[image]

Hyperlinks Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Add | Adds a new Hyperlink object to the specified Hyperlinks collection and returns the new Hyperlink object.


Shapes Members (Publisher)

 Copy code hover
[image]

Shapes Members (Publisher)
Send feedback

A collection of Shape objects that represent all the shapes on a page of a publication. Each Shape object represents an object in the drawing layer, such as an AutoShape, freeform, OLE object, or picture.

Methods

Name | Description
AddBuildingBlock | Adds a BuildingBlock object and returns a Shape object on the page that represents the building block.
AddCallout | Adds a new Shape object representing a borderless line callout to the specified Shapes collection.
AddCatalogMergeArea | Adds a Shape object that represents the specified publication's catalog merge area.
AddCatalogMergeFieldToCanvas | Adds a catalog merge field of the specified type to the canvas. Returns nothing.
AddConnector | Adds a new Shape object representing a connector to the specified Shapes collection.
AddCurve | Adds a new Shape object representing a Bézier curve to the specified Shapes collection.
AddEmptyPictureFrame | Returns a Shape object that represents an empty picture frame inserted at the specified coordinates.
AddGroupWizard | Adds a Shape object representing a Design Gallery object to the publication.
AddLabel | Adds a new Shape object representing a text label to the specified Shapes collection.
AddLine | Adds a new Shape object representing a line to the specified Shapes collection.
AddOLEObject | Adds a new Shape object representing an OLE object to the specified Shapes collection.
AddPicture | Adds a new Shape object representing a picture to the specified Shapes collection.
AddPolyline | Adds a new Shape object representing an open polyline or a closed polygon to the specified Shapes collection.
AddShape | Adds a new Shape object representing an AutoShape to the specified Shapes collection.
AddTable | Adds a new Shape object representing a table to the specified Shapes collection.
AddTextbox | Adds a new Shape object representing a text box to the specified Shapes collection.
AddTextEffect | Adds a new Shape object representing a WordArt object to the specified Shapes collection.
AddWebControl | Adds a new Shape object representing a Web form control to the specified Shapes collection.
AddWebNavigationBar | Adds a Shape object of type pbWebNavigationBar to the current page of a publication.
AddWordArt | Returns a Shape object that represents the WordArt to be added to the publication.
BuildFreeform | Builds a freeform object. Returns a FreeformBuilder object that represents the freeform as it is being built.
FindShapeByWizardTag | Returns a ShapeRange object representing one or all of the shapes placed in a publication by a wizard and bearing the specified wizard tag.
Item | Returns an individual object in a specified collection.
Paste | Pastes the shapes or text on the Clipboard into the specified Shapes collection, at the top of the z-order. Each pasted object becomes a member of the specified Shapes collection. If the Clipboard contains a text range, the text will be pasted into a newly created TextFrame shape. Returns a ShapeRange object that represents the pasted objects.
Range | Returns a ShapeRange object that represents a subset of the shapes in a Shapes collection.
SelectAll | Selects all the shapes in the specified Shapes collection.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
CanvasArrangementType | A pbCanvasArrangementType constant that specifies the arrangement type of the canvas. Read/write.
CanvasesCount | A Long that specifies the number of canvases in the Shapes collection. Read-only.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Shape.WebNavigationBarSetName Property (Publisher)

 Copy code hover
[image]

Shape.WebNavigationBarSetName Property (Publisher)
Send feedback

Returns a String that represents the name of the Web navigation bar set the specified shape is an instance of. Read-only.

Syntax

expression .WebNavigationBarSetName

expression A variable that represents a Shape object.

Return Value

String

Remarks

This property is only accessible for shapes that represent an instance of a Web navigation bar set. Use the Type property of the Shape object to determine if a shape represents an instance of a Web navigation bar set.

Use the WebNavigationBarSetName property to return the name of a WebNavigationBarSet object. Multiple pages in a Web publication can each have a shape representing an instance of the same Web navigation bar set. Changes made to a WebNavigationBarSet object are reflected in all the shapes representing instances of that Web navigation bar set.

Example

The following example tests to determine which shapes on the first page of the active document represent instances of Web navigation bars. For each such shape found, the Web navigation bar it represents an instance of is set to auto update.

VBA Copy code Copy code
Sub SetWebBarsToAutoUpdate()

Dim shpLoop As Shape
Dim strWebNavBarName As String

For Each shpLoop In ActiveDocument.Pages(1).Shapes
 If shpLoop.Type = pbWebNavigationBar Then

 strWebNavBarName = shpLoop.WebNavigationBarSetName
 With ActiveDocument.WebNavigationBarSets(strWebNavBarName)
 .AutoUpdate = True
 End With

 End If
Next

End Sub


Font.StylisticSets Property (Publisher)

 Copy code hover
[image]

Font.StylisticSets Property (Publisher)
Send feedback

Returns or sets a Variant that represents the state of the StylisticSets property on the characters in a text range. Read/write.

Version Information

Version Added: Publisher 2010

Syntax

expression .StylisticSets

expression A variable that represents a Font object.

Remarks

The StylisticSets property applies from one to twenty increasingly complex sets of typography styles to the selected font.

Possible values for the StylisticSets property and how they correspond to identifiers for stylistic sets in the user interface (UI) are shown in the following table. A value of zero (0) indicates that no stylistic set is applied.

StylisticSets property value | Stylistic set identifier in UI
0 | 0
1 | 1
2 | 2
4 | 3
8 | 4

The number of stylistic sets available varies, depending on the font.

Note Note

The StylisticSets property has an effect only for OpenType fonts that contain stylistic sets.


ScratchArea.Shapes Property (Publisher)

 Copy code hover
[image]

ScratchArea.Shapes Property (Publisher)
Send feedback

Returns a Shapes collection that represents all the Shape objects in the specified publication. This collection can contain drawings, shapes, pictures, OLE objects, ActiveX controls, text objects, and callouts.

Syntax

expression .Shapes

expression A variable that represents a ScratchArea object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example adds a rectangle to the first page in the active publication.

Copy code Copy code
Sub AddNewRectangle()
 ActiveDocument.Pages(1).Shapes.AddShape Type:=msoShapeRectangle, _
 Left:=5, Top:=25, Width:=100, Height:=50
End Sub

This example sets the fill texture for all the shapes in the active publication. This example assumes there is at least one shape in the active publication.

Copy code Copy code
Sub SetNewTextureForAllShapes()
 Dim shp As Shape
 For Each shp In ActiveDocument.Pages(1).Shapes
 shp.Fill.PresetTextured PresetTexture:=msoTextureOak
 Next shp
End Sub

This example adds a shadow to the first shape in the active publication. This example assumes there is at least one shape in the active publication.

Copy code Copy code
Sub SetShadowForFirstShape()
 ActiveDocument.Pages(1).Shapes(1).Shadow.Type = msoShadow6
End Sub

This example displays a count of all shapes on the first page of the active publication. This example assumes there is at least one shape in the active publication.

Copy code Copy code
Sub CountShapesOnFirstPage()
 MsgBox "You have " & ActiveDocument.Pages(1) _
 .Shapes.Count & " shapes on the first page."
End Sub


ObjectVerbs.Count Property (Publisher)

 Copy code hover
[image]

ObjectVerbs.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents an ObjectVerbs object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


ParagraphFormat Object (Publisher)

 Copy code hover
[image]

ParagraphFormat Object (Publisher)
Send feedback

Represents all the formatting for a paragraph.

Example

Use the ParagraphFormat property to return the ParagraphFormat object for a paragraph or paragraphs. The ParagraphFormat property returns the ParagraphFormat object for a selection, range, or style. The following example centers the paragraph at the cursor position. This example assumes that the first shape is a text box and not another type of shape.

Copy code Copy code
Sub CenterParagraph()
 Selection.TextRange.ParagraphFormat _
 .Alignment = pbParagraphAlignmentCenter
End Sub

Use the Duplicate property to copy an existing ParagraphFormat object. The following example duplicates the paragraph formatting of the first paragraph in the active publication and stores the formatting in a variable. This example duplicates an existing ParagraphFormat object and then changes the left indent to one inch, creates a new textbox, inserts text into it, and applies the paragraph formatting of the duplicated paragraph format to the text.

Copy code Copy code
Sub DuplicateParagraphFormating()
 Dim pfmtDup As ParagraphFormat

 Set pfmtDup = ActiveDocument.Pages(1).Shapes(1).TextFrame _
 .TextRange.ParagraphFormat.Duplicate

 pfmtDup.LeftIndent = Application.InchesToPoints(1)

 With ActiveDocument.Pages.Add(Count:=1, After:=1)
 With .Shapes.AddTextbox(pbTextOrientationHorizontal, _
 Left:=72, Top:=72, Width:=200, Height:=100)
 With .TextFrame.TextRange
 .Text = "This is a test of how to use " & _
 "the ParagraphFormat object."
 .ParagraphFormat = pfmtDup
 End With
 End With
 End With

End Sub


Options.TypeNReplace Property (Publisher)

 Copy code hover
[image]

Options.TypeNReplace Property (Publisher)
Send feedback

True for Microsoft Publisher to replace unreadable Asian character clusters resulting from invalid keyboard sequences. Read/write Boolean.

Syntax

expression .TypeNReplace

expression A variable that represents a Options object.

Return Value

Boolean

Example

This example instructs Publisher to replace unreadable Asian character clusters resulting from invalid keyboard sequences.

VBA Copy code Copy code
Sub TypeReplace()
 Options.TypeNReplace = True
End Sub


MailMergeDataSource.SetSortOrder Method (Publisher)

 Copy code hover
[image]

MailMergeDataSource.SetSortOrder Method (Publisher)
Send feedback

Sets the sort order for mail merge data.

Syntax

expression .SetSortOrder(SortField1, SortAscending1, SortField2, SortAscending2, SortField3, SortAscending3)

expression A variable that represents a MailMergeDataSource object.

Parameters

Name | Required/Optional | Data Type | Description
SortField1 | Optional | String | The first field on which to sort the mail merge data. Default is an empty string.
SortAscending1 | Optional | Boolean | True (default) to perform an ascending sort on SortField1; False to perform a descending sort.
SortField2 | Optional | String | The second field on which to sort the mail merge data. Default is an empty string.
SortAscending2 | Optional | Boolean | True (default) to perform an ascending sort on SortField2; False to perform a descending sort.
SortField3 | Optional | String | The third field on which to sort the mail merge data. Default is an empty string.
SortAscending3 | Optional | Boolean | True (default) to perform an ascending sort on SortField3; False to perform a descending sort.

Example

The following example sorts mail merge data first on postal code in descending order, then on last name and first name in ascending order.

Copy code Copy code
ActiveDocument.MailMerge.DataSource.SetSortOrder _
 SortField1:="ZIPCode", SortAscending1:=False, _
 SortField2:="LastName", SortField3:="FirstName"


ThreeDFormat.BevelTopDepth Property (Publisher)

 Copy code hover
[image]

ThreeDFormat.BevelTopDepth Property (Publisher)
See also Send feedback

Returns or sets a Single that represents the depth of the top bevel. Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .BevelTopDepth

expression A variable that represents a ThreeDFormat object.

Property value

Single

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


PictureFormat.ReplaceEx Method (Publisher)

 Copy code hover
[image]

PictureFormat.ReplaceEx Method (Publisher)
Send feedback

Replaces the specified picture, optionally fitting the replacement picture to the frame or filling the frame. Returns nothing.

Version Information

Version Added: Publisher 2010

Syntax

expression .ReplaceEx(Pathname, InsertAs, Fit)

expression A variable that represents a PictureFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Pathname | Required | String | The name and path of the file with which you want to replace the specified picture.
InsertAs | Optional | PbPictureInsertAs | The manner in which you want the picture file inserted into the document: linked or embedded.
Fit | Optional | pbPictureInsertFit | Whether the inserted picture is fit to the frame, or fills the frame.

Remarks

The InsertAs parameter can be one of the following PbPictureInsertAs constants declared in the Microsoft Publisher type library. The default value is pbPictureInsertAsOriginalState.

pbPictureInsertAsEmbedded

pbPictureInsertAsLinked

pbPictureInsertAsOriginalState

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the ReplaceEx method to replace all the pictures in a publication with a different picture. In this example, the replacement picture is fit to the frames of the previous pictures, but you can use pbFill in place of pbFit if you want to fill the frames instead. This example also excludes pictures on master pages.

Before running this macro, replace replacementPicturePath with the path to the picture you want to use as the replacement.

VBA Copy code Copy code
Public Sub ReplaceEx_Example()

    Dim pubPage As Page
    Dim pubShape As Shape
    Dim strReplacePicturePath As String

    strReplacePicturePath = replacementPicturePath

    For Each pubPage In ActiveDocument.Pages

        For Each pubShape In pubPage.Shapes

            If pubShape.Type = pbPicture Then

                pubShape.PictureFormat.ReplaceEx strReplacePicturePath, pbPictureInsertAsOriginalState, pbFit

            End If

        Next pubShape

    Next pubPage

End Sub


Using Events with the Document Object (Publisher)

 Copy code hover
[image]

Using Events with the Document Object (Publisher)
Send feedback

The Document object supports seven events: BeforeClose, Open, Redo, ShapesAdded, ShapesRemoved, Undo, and WizardAfterChange. You write procedures to respond to these events in the class module named "ThisDocument". Use the following steps to create an event procedure.

  1. Under your publication project in the Project Explorer window, double-click ThisDocument. (In Folder view, ThisDocument is located in the Microsoft Publisher Objects folder.)

  2. Select Document from the Object drop-down list box.

  3. Select an event from the Procedure drop-down list box. An empty subroutine is added to the class module.

  4. Add the Visual Basic instructions you want to run when the event occurs.

Example

This example shows an Open event procedure that displays a message when a publication is opened.

Copy code Copy code
Private Sub Document_Open()
    MsgBox "This publication is copyrighted."
End Sub

The following example shows a BeforeClose event procedure that prompts the user for a yes or no response before closing a document.

Copy code Copy code
Private Sub Document_BeforeClose(Cancel As Boolean)
    Dim intResponse As Integer

    intResponse = MsgBox("Do you really want to close " _
        & "the document?", vbYesNo)

    If intResponse = vbNo Then Cancel = True
End Sub
Note Note

For information on creating event procedures for the Application object, see Using Events with the Application Object .


ReaderSpread Properties (Publisher)

 Copy code hover
[image]

ReaderSpread Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Height | Returns a Single that represents the height, in points, of the page. Read-only.
Left | Returns a Single indicating the position (in points) of the left edge of the reader spread from the workspace. Read-only.
PageCount | Returns a Long indicating the number of pages in the specified reader spread. Read-only.
Pages | Returns a Page object representing one of the pages that compose the specified reader spread.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Top | Returns the a Single that represents the distance (in points) from the top edge of the workspace to the top edge of the page. Read-only.
Width | Returns a Single that represents the width, in points, of the page. Read-only.


MailMergeDataSource.ActiveRecord Property (Publisher)

 Copy code hover
[image]

MailMergeDataSource.ActiveRecord Property (Publisher)
Send feedback

Returns or sets a Long that represents the active mail merge record. Read/write.

Syntax

expression .ActiveRecord

expression A variable that represents a MailMergeDataSource object.

Return Value

Long

Remarks

The active record number is the position of the record in the query result produced by the current query options; as such, this number is not necessarily the position of the record in the data source.

Example

This example validates that the value entered into the PostalCode field is ten characters long (U.S. ZIP Code plus 4-digit locator code). If it is not, it is excluded from the mail merge and marked with a comment.

Copy code Copy code
Sub ValidateZip()

 Dim intCount As Integer

 On Error Resume Next

 With ActiveDocument.MailMerge.DataSource

 'Set the active record equal to the first included
 'record in the data source
 .ActiveRecord = 1
 Do
 intCount = intCount + 1

 'Set the condition that the PostalCode field
 'must be greater than or equal to ten digits
 If Len(.DataFields.Item("PostalCode").Value) < 10 Then

 'Exclude the record if the PostalCode field
 'is less than ten digits
 .Included = False

 'Mark the record as containing an invalid address field
 .InvalidAddress = True

 'Specify the comment attached to the record explaining
 'why the record was excluded from the mail merge
 .InvalidComments = "The ZIP code for this record is " _
 & "less than ten digits. It will be removed " _
 & "from the mail merge process."

 End If

 'Move the record to the next record in the data source
 .ActiveRecord = .ActiveRecord + 1

 'End the loop when the counter variable
 'equals the number of records in the data source
 Loop Until intCount = .RecordCount
 End With

End Sub


AdvancedPrintOptions.Application Property (Publisher)

 Copy code hover
[image]

AdvancedPrintOptions.Application Property (Publisher)
See also Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents an AdvancedPrintOptions object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next

See also

Concepts

AdvancedPrintOptions Object

Other resources

AdvancedPrintOptions Object Members


PbSaveOptions Enumeration (Publisher)

 Copy code hover
[image]

PbSaveOptions Enumeration (Publisher)
Send feedback

Specifies what Microsoft Publisher should do if there is already an open publication with unsaved changes.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbDoNotSaveChanges | 3 | Close the open publication without saving any changes.
pbPromptToSaveChanges | 1 | Default. Prompt the user whether to save changes in the open publication.
pbSaveChanges | 2 | Save the open publication before closing it.


View Members (Publisher)

 Copy code hover
[image]

View Members (Publisher)
Send feedback

Contains the view attributes (show all, field shading, table gridlines, and so on) for a window or pane.

Methods

Name | Description
ScrollShapeIntoView | Scrolls the publication window so that the specified shape is displayed in the publication window or pane.
ZoomIn | Increases the magnification of the specified view.
ZoomOut | Decreases the magnification of the specified view.

Properties

Name | Description
ActivePage | Returns a Page object that represents the page currently displayed in the Microsoft Publisher window.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Zoom | Returns or sets a PbZoom constant or a value between 10 and 400 indicating the zoom setting of the specified view. Read/write.


MailMergeMappedDataField Properties (Publisher)

 Copy code hover
[image]

MailMergeMappedDataField Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
DataFieldName | Returns or sets a String which represents the name of the field in the mail merge data source to which a mapped data field maps. An empty string is returned if the specified data field is not mapped to a mapped data field. Read/write.
Index | Returns a Long that represents the position of a particular item in a specified collection. .
Name | Returns a String value indicating the name of the specified object. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Value | Returns a String that represents the value of a mail merge data field record or a mapped data field. Read-only.


BorderArts Object (Publisher)

 Copy code hover
[image]

BorderArts Object (Publisher)
See also Send feedback

A collection of all BorderArt available for use in the specified publication. BorderArt is predefined picture borders that can be applied to text boxes, picture frames, or rectangles.

Remarks

The BorderArts collection includes any custom BorderArt types created by the user for the specified publication.

Example

Use the Item property of a BorderArts collection to return a specific BorderArt object. The Index argument of the Item property can be the number or name of the BorderArt object.

This example returns the BorderArt "Apples" from the active publication.

Copy code Copy code
Dim bdaTemp As BorderArt

Set bdaTemp = ActiveDocument.BorderArts.Item (Index:="Apples")

Use the Count property to return the number of BorderArt types available in the specified document. The following example displays the number of BorderArt types in the active document.

Copy code Copy code
Sub CountBorderArts()
 MsgBox ActiveDocument.BorderArts.Count
End Sub

See also

Other resources

BorderArts Object Members


WebNavigationBarSet.Application Property (Publisher)

 Copy code hover
[image]

WebNavigationBarSet.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a WebNavigationBarSet object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


HeaderFooter Members (Publisher)

 Copy code hover
[image]

HeaderFooter Members (Publisher)
Send feedback

Represents the header or footer of a master page.

Methods

Name | Description
Delete | Deletes the specified object.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
IsHeader | True if the specified HeaderFooter object is a header, False if it is a footer. Read-only Boolean.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
TextRange | Returns a TextRange object that represents the text that is attached to a shape and properties and methods for manipulating the text.


InlineShapes Object (Publisher)

 Copy code hover
[image]

InlineShapes Object (Publisher)
Send feedback

Contains a collection of Shape objects, which represent objects in the drawing layer, where Shape.IsInline is True. The collection of shapes is limited to shapes within a given text range.

Remarks

The InlineShapes collection is available only on the TextRange object. Using TextFrame.Story.TextRange.InlineShapes will return all inline shapes in a text frame, including those that are in overflow. Using TextFrame.TextRange.InlineShapes will return only visible inline shapes in a text frame, and not those that are in overflow.

The InlineShapes collection can also be accessed from Document.Stories(i).TextRange, where i is the index to the active page of the publication.

The InlineShapes collection is not available in the Page.Shapes collection, including its contained ShapeRange.

Example

Use the InlineShapes property on the TextRange object to return an InlineShapes collection. The following example finds the first shape, a text box, on page one of the publication, and appends text to the end of the text range in the text box if there is more than one inline shape within the text range.

Copy code Copy code
Dim theShape As Shape

Set theShape = ActiveDocument.Pages(1).Shapes(1)

With theShape.TextFrame.TextRange
 If .InlineShapes.Count > 1 Then
 .InsertAfter (" There is more than one inline shape in this text box.")
 End If
End With

Use the InlineShapes(index) property to return a single inline shape. The following example finds the third inline shape within a text box and flips it vertically.

Copy code Copy code
Dim theShape As Shape

Set theShape = ActiveDocument.Pages(1).Shapes(1)

With theShape.TextFrame.Story.TextRange
 With .InlineShapes(3)
 .Flip (msoFlipVertical)
 End With
End With

Use the Range method to return a ShapeRange object that contains all members of the InlineShapes collection. An array of indexes or strings or a single index or string can be passed as a parameter of the Range property to select particular shapes or a shape within the range. The following example sets a ShapeRange variable equal to the collection of inline shapes that exist within a text box. Each inline shape within the range is then modified in some way. This example assumes that the first shape on the page is a text box that contains three inline shapes.

Copy code Copy code
Dim theRange As ShapeRange

Set theRange = ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.Story.TextRange.InlineShapes.Range

With theRange
 .Item(1).Flip msoFlipVertical
 .Item(2).MoveOutOfTextFlow
 .Item(3).Delete
End With


ShapeRange.ConnectorFormat Property (Publisher)

 Copy code hover
[image]

ShapeRange.ConnectorFormat Property (Publisher)
Send feedback

Returns a ConnectorFormat object that contains connector formatting properties. Applies to Shape or ShapeRange objects that represent connectors.

Syntax

expression .ConnectorFormat

expression A variable that represents a ShapeRange object.

Example

This example adds two rectangles to the first page in the active publication and connects them with a curved connector.

Copy code Copy code
Dim shpRect1 As Shape
Dim shpRect2 As Shape

With ActiveDocument.Pages(1).Shapes

 ' Add two new rectangles.
 Set shpRect1 = .AddShape(Type:=msoShapeRectangle, _
 Left:=100, Top:=50, Width:=200, Height:=100)
 Set shpRect2 = .AddShape(Type:=msoShapeRectangle, _
 Left:=300, Top:=300, Width:=200, Height:=100)

 ' Add a new curved connector.
 With .AddConnector(Type:=msoConnectorCurve, _
 BeginX:=0, BeginY:=0, EndX:=100, EndY:=100) _
 .ConnectorFormat

 ' Connect the new connector to the two rectangles.
 .BeginConnect ConnectedShape:=shpRect1, ConnectionSite:=1
 .EndConnect ConnectedShape:=shpRect2, ConnectionSite:=1

 ' Reroute the connector to create the shortest path.
 .Parent.RerouteConnections
 End With

End With


Shapes.AddTable Method (Publisher)

 Copy code hover
[image]

Shapes.AddTable Method (Publisher)
Send feedback

Adds a new Shape object representing a table to the specified Shapes collection.

Syntax

expression .AddTable(NumRows, NumColumns, Left, Top, Width, Height, FixedSize, Direction)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
NumRows | Required | Long | The number of rows in the new table. Values between 1 and 128 are valid; any values outside this range will generate an error.
NumColumns | Required | Long | The number of columns in the new table. Values between 1 and 128 are valid; any values outside this range will generate an error.
Left | Required | Variant | The position of the left edge of the shape representing the table.
Top | Required | Variant | The position of the top edge of the shape representing the table.
Width | Required | Variant | The width of the shape representing the table.
Height | Required | Variant | The height of the shape representing the table.
FixedSize | Optional | Boolean | True if Microsoft Publisher reduces the number of rows and columns of the table to fit the specified width and height. False if Publisher automatically increases the width and height of the table frame to accommodate the number of rows and columns in the table. Default is False.
Direction | Optional | PbTableDirectionType | The direction in which table columns are numbered. The default depends on the current language setting.

Return Value

Shape

Remarks

For the Left, Top, Width, and Height arguments, numeric values are evaluated in points; strings can be in any units supported by Publisher (for example, "2.5 in").

The Direction parameter can be one of the PbTableDirectionType constants declared in the Microsoft Publisher type library and shown in the following table.

Constant | Description
pbTableDirectionLeftToRight | Table columns are numbered from left to right. Default for left-to-right languages.
pbTableDirectionRightToLeft | Table columns are numbered from right to left. Default for right-to-left languages.

Example

This example creates a new table on the first page of the active publication.

VBA Copy code Copy code
Dim shpTable As Shape

Set shpTable = ActiveDocument.Pages(1).Shapes.AddTable _
 (NumRows:=3, NumColumns:=4, _
 Left:=10, Top:=10, _
 Width:=288, Height:=216)


Application.Name Property (Publisher)

 Copy code hover
[image]

Application.Name Property (Publisher)
See also Send feedback

Returns a String value indicating the name of the specified object. Read-only.

Syntax

expression .Name

expression A variable that represents an Application object.

Remarks

You can use an object's name in conjunction with the Item method or Item property to return a reference to the object if the Item method or property for the collection that contains the object takes a Variant argument. For example, if the value of the Name property for a shape is Rectangle 2, then .Shapes("Rectangle 2") will return a reference to that shape.

The Name property is the default property for the BorderArt, BorderArtFormat, and Label objects.

See also

Concepts

Application Object

Other resources

Application Object Members


TextRange.BoundLeft Property (Publisher)

 Copy code hover
[image]

TextRange.BoundLeft Property (Publisher)
Send feedback

Returns a Single indicating the distance, in points, from the left edge of the leftmost page to the left edge of the bounding box for the specified text range. Read-only.

Syntax

expression .BoundLeft

expression A variable that represents a TextRange object.

Return Value

Single

Example

The following example displays the position, width, and height of the bounding box surrounding the text in the first shape on page one of the active publication.

Copy code Copy code
Dim rngText As TextRange
Dim strMessage As String

Set rngText = ActiveDocument.Pages(1) _
 .Shapes(1).TextFrame.TextRange

With rngText
 strMessage = "Text frame information" & vbCrLf _
 & " Distance from left edge of page: " _
 & .BoundLeft & " points" & vbCrLf _
 & " Distance from top edge of page: " _
 & .BoundTop & " points" & vbCrLf _
 & " Width: " & .BoundWidth & " points" & vbCrLf _
 & " Height: " & .BoundHeight & " points"
End With

MsgBox strMessage


FreeformBuilder.Application Property (Publisher)

 Copy code hover
[image]

FreeformBuilder.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a FreeformBuilder object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


TextStyle Methods (Publisher)

 Copy code hover
[image]

TextStyle Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified object.


ThreeDFormat.BevelBottomInset Property (Publisher)

 Copy code hover
[image]

ThreeDFormat.BevelBottomInset Property (Publisher)
See also Send feedback

Returns or sets a Single that represents the inset size for the bottom bevel. Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .BevelBottomInset

expression A variable that represents a ThreeDFormat object.

Return value

Single

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


Adjustments.Count Property (Publisher)

 Copy code hover
[image]

Adjustments.Count Property (Publisher)
See also Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents an Adjustments object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub

See also

Concepts

Adjustments Object

Other resources

Adjustments Object Members


Cell.MarginLeft Property (Publisher)

 Copy code hover
[image]

Cell.MarginLeft Property (Publisher)
Send feedback

Returns or sets a Variant that represents the amount of space (in points) between the text and the left edge of a cell, text frame, or page. Read/write.

Syntax

expression .MarginLeft

expression A variable that represents a Cell object.

Example

This example sets the margins of the active publication to two inches.

Copy code Copy code
Sub SetPageMargins()

 With ActiveDocument.LayoutGuides
 .MarginTop = Application.InchesToPoints(Value:=2)
 .MarginBottom = Application.InchesToPoints(Value:=2)
 .MarginLeft = Application.InchesToPoints(Value:=2)
 .MarginRight = Application.InchesToPoints(Value:=2)
 End With

End Sub


ShapeRange.IncrementLeft Method (Publisher)

 Copy code hover
[image]

ShapeRange.IncrementLeft Method (Publisher)
Send feedback

Moves the specified shape or shape range horizontally by the specified distance.

Syntax

expression .IncrementLeft(Increment)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Variant | The horizontal distance to move the shape or shape range. A positive value moves the shape or shape range to the right; a negative value moves it to the left. Numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

Return Value

Nothing

Remarks

Use the IncrementTop method to move shapes or shape ranges vertically.

Example

This example duplicates the first shape on the active publication, sets the fill for the duplicate, moves it 70 points to the right and 50 points up, and rotates it 30 degrees clockwise.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes(1).Duplicate
 .Fill.PresetTextured PresetTexture:=msoTextureGranite
 .IncrementLeft Increment:=70
 .IncrementTop Increment:=-50
 .IncrementRotation Increment:=30
End With


Hyperlink.PageID Property (Publisher)

 Copy code hover
[image]

Hyperlink.PageID Property (Publisher)
Send feedback

Returns or sets a Long indicating the page in the publication that is the destination for the specified hyperlink. Read/write.

Syntax

expression .PageID

expression A variable that represents a Hyperlink object.

Example

The following example reports what page the first hyperlink in the active publication is linked to.

VBA Copy code Copy code
Dim hypTemp As Hyperlink
Dim lngID As Long
Dim strPage As String

Set hypTemp = ActiveDocument.Pages(1).Shapes(1).Hyperlink

lngID = hypTemp.PageID
strPage = ActiveDocument.Pages.FindByPageID(PageID:=lngID).PageNumber

MsgBox "This hyperlink goes to the page " & strPage & "."


Page.Background Property (Publisher)

 Copy code hover
[image]

Page.Background Property (Publisher)
Send feedback

Sets or returns a PageBackground object representing the background of the specified page.

Syntax

expression .Background

expression A variable that represents a Page object.

Return Value

PageBackground

Remarks

This property is for publication pages only. Any attempt to create a background for a master page will return a "Permission denied" error.

Example

The following example creates a PageBackground object and sets it to the background of the first page of the active document.

Copy code Copy code
Dim objPageBackground As PageBackground
Set objPageBackground = ActiveDocument.Pages(1).Background


Shape.SoftEdge Property (Publisher)

 Copy code hover
[image]

Shape.SoftEdge Property (Publisher)
See also Send feedback

Returns a SoftEdgeFormat object that represents the soft edge formatting for a shape. Read-only.

Version Information

Version Added: Publisher 2013

Syntax

expression .SoftEdge

expression A variable that represents a Shape object.

Return value

SOFTEDGEFORMAT

See also

Other resources

Shape Object
Shape Object Members


BorderArts.Parent Property (Publisher)

 Copy code hover
[image]

BorderArts.Parent Property (Publisher)
See also Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a BorderArts object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub

See also

Concepts

BorderArts Object

Other resources

BorderArts Object Members


ParagraphFormat.AttachedToText Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.AttachedToText Property (Publisher)
Send feedback

True if the Font or ParagraphFormat object is attached to a TextRange object. If the object is attached to a TextRange object, the document will be updated when properties of the object are changed. If the object is not attached, nothing in the document will be changed until the object is applied to a TextRange or Style object. Read-only Boolean.

Syntax

expression .AttachedToText

expression A variable that represents a ParagraphFormat object.

Example

This example duplicates the font formatting; then it checks to see if the duplicated formatting is attached to a text range and if it is not, it attaches the formatting to the second shape.

Copy code Copy code
Sub DuplicateText()
 Dim fntTemp As Font
 With ActiveDocument.Pages(1)
 Set fntTemp = .Shapes(1).TextFrame.TextRange.Font.Duplicate
 If fntTemp.AttachedToText <> True Then _
 ActiveDocument.Pages(1).Shapes(2) _
 .TextFrame.TextRange.Font = fntTemp
 End With
End Sub


WebListBoxItems.AddItem Method (Publisher)

 Copy code hover
[image]

WebListBoxItems.AddItem Method (Publisher)
Send feedback

Adds list items to a Web list box control.

Syntax

expression .AddItem(Item, Index, SelectState, ItemValue)

expression A variable that represents a WebListBoxItems object.

Parameters

Name | Required/Optional | Data Type | Description
Item | Required | String | The name of the item as it appears in the list.
Index | Optional | Long | The number of the list item. If Index is not specified or it is out of range of the indices of existing list box items, the new item will be added to the end of the list box. Otherwise the new item will be inserted at the position specified by Index and the index position of all items after it will be increased by one.
SelectState | Optional | Boolean | True if the item is selected when the list box is initially displayed. Default value is False.
ItemValue | Optional | String | The value of the list box item. If not specified, the new item's value will be the same as the item name.

Remarks

When you programmatically create a new Web list box, it contains three items. Use the Delete method to remove them from the list.

Example

This example creates a new list box control in the active publication, removes the three default list items, and then adds several items to it.

Copy code Copy code
Sub AddListBoxItems()
 Dim intCount As Integer
 With ActiveDocument.Pages(1).Shapes.AddWebControl _
 (Type:=pbWebControlListBox, Left:=100, _
 Top:=100, Width:=150, Height:=100)
 With .WebListBox.ListBoxItems
 For intCount = 1 To .Count
 .Delete (1)
 Next
 .AddItem Item:="Green"
 .AddItem Item:="Yellow"
 .AddItem Item:="Red"
 .AddItem Item:="Blue"
 .AddItem Item:="Purple"
 .AddItem Item:="Chartreuse"
 .AddItem Item:="Pink"
 .AddItem Item:="Olive"
 End With
 End With
End Sub


CatalogMergeShapes.HorizontalRepeat Property (Publisher)

 Copy code hover
[image]

CatalogMergeShapes.HorizontalRepeat Property (Publisher)
Send feedback

Returns a Long that represents the number of times the catalog merge area will repeat across the target publication page when the catalog merge is executed. Read-only.

Syntax

expression .HorizontalRepeat

expression A variable that represents a CatalogMergeShapes object.

Return Value

Long

Remarks

When the catalog merge is executed, the catalog merge area repeats once for each selected record in the specified data source.

The number of times the catalog merge area repeats across the page is determined by the width of the area. Use the Width property of the Shape object to return or set the horizontal size of the catalog merge area.

The VerticalRepeat property of the CatalogMergeShapes object represents the number of times the catalog merge area repeats vertically down the target publication page.

Example

The following example returns the number of times the catalog merge area will repeat horizontally and vertically on the target publication page when the catalog merge is performed. This example assumes the catalog merge area is the first shape on the first page of the specified publication.

Copy code Copy code
Sub CatalogMergeDimensions()

 With ThisDocument.Pages(1).Shapes(1)
 Debug.Print .Width
 Debug.Print .CatalogMergeItems.HorizontalRepeat
 Debug.Print .Height
 Debug.Print .CatalogMergeItems.VerticalRepeat
 End With

End Sub


LayoutGuides.ColumnGutterWidth Property (Publisher)

 Copy code hover
[image]

LayoutGuides.ColumnGutterWidth Property (Publisher)
Send feedback

Returns or sets the width of the column gutters that are used by the LayoutGuides object to aid in the process of laying out design elements. Read/write Single.

Syntax

expression .ColumnGutterWidth

expression A variable that represents a LayoutGuides object.

Return Value

Single

Remarks

The default width of column gutters is 0.4 inches.

Example

The following example modifies the second master page of the active publication so that it has four rows and four columns, row gutter width of 0.75 inches, column gutter width of 0.5 inches, and center lines in the gutters. Any new pages added to the publication that use the second master page as a template will have these properties.

Copy code Copy code
Dim theMasterPage As page
Dim theLayoutGuides As LayoutGuides

Set theMasterPage = ActiveDocument.MasterPages(2)
Set theLayoutGuides = theMasterPage.LayoutGuides

With theLayoutGuides
 .Rows = 4
 .Columns = 4
 .RowGutterWidth = Application.InchesToPoints(0.75)
 .ColumnGutterWidth = Application.InchesToPoints(0.5)
 .GutterCenterlines = True
End With


ColorFormat.TintAndShade Property (Publisher)

 Copy code hover
[image]

ColorFormat.TintAndShade Property (Publisher)
Send feedback

Returns or sets a Single that represents the lightening or darkening of a specified shape's color. Read/write.

Syntax

expression .TintAndShade

expression A variable that represents a ColorFormat object.

Return Value

Single

Remarks

You can enter a number from -1 (darkest) to 1 (lightest) for the TintAndShade property, 0 (zero) being neutral.

Example

This example creates a new shape in the active document, sets the fill color, and lightens the color shade.

VBA Copy code Copy code
Sub NewTintedShape()
 Dim shpHeart As Shape
 Set shpHeart = ActiveDocument.Pages(1).Shapes _
 .AddShape(Type:=msoShapeHeart, Left:=150, _
 Top:=150, Width:=250, Height:=250)
 With shpHeart.Fill.ForeColor
 .CMYK.SetCMYK Cyan:=255, Magenta:=28, Yellow:=0, Black:=0
 .TintAndShade = 0.3
 End With
End Sub


BuildingBlock.Delete Method (Publisher)

 Copy code hover
[image]

BuildingBlock.Delete Method (Publisher)
Send feedback

Deletes the specified BuildingBlock object from the BuildingBlocks collection returned by the Document.AvailableBuildingBlocks property for the current document.

Syntax

expression .Delete

expression A variable that represents a BuildingBlock object.


Rows Properties (Publisher)

 Copy code hover
[image]

Rows Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


TabStop.Position Property (Publisher)

 Copy code hover
[image]

TabStop.Position Property (Publisher)
Send feedback

Returns or sets a Variant representing the font position relative to the baseline of the text in the specified range. Positive values move the text above the normal baseline, negative values move the text below the baseline. Indeterminate values are returned as -9999.0. Read/write.

Syntax

expression .Position

expression A variable that represents a TabStop object.

Example

This example adjusts the text in the second story to 5 points below the baseline.

Copy code Copy code
Sub Position()

 Application.ActiveDocument.Stories(2).TextRange.Font.Position = -5

End Sub


FreeformBuilder.ConvertToShape Method (Publisher)

 Copy code hover
[image]

FreeformBuilder.ConvertToShape Method (Publisher)
Send feedback

Creates a shape that has the geometric characteristics of the specified FreeformBuilder object. Returns a Shape object that represents the new shape.

Syntax

expression .ConvertToShape

expression A variable that represents a FreeformBuilder object.

Return Value

Shape

Remarks

You must apply the AddNodes method to a FreeformBuilder object at least once before you use the ConvertToShape method or an error occurs.

Example

This example adds a freeform with four vertices to the first page in the active publication.

Copy code Copy code
' Add a new freeform object.
With ActiveDocument.Shapes _
 .BuildFreeform(EditingType:=msoEditingCorner, _
 X1:=100, Y1:=100)

 ' Add three more nodes and close the polygon.
 .AddNodes SegmentType:=msoSegmentCurve, _
 EditingType:=msoEditingCorner, _
 X1:=200, Y1:=200, X2:=225, Y2:=250, X3:=250, Y3:=200
 .AddNodes SegmentType:=msoSegmentCurve, _
 EditingType:=msoEditingAuto, X1:=200, Y1:=100
 .AddNodes SegmentType:=msoSegmentLine, _
 EditingType:=msoEditingAuto, X1:=150, Y1:=50
 .AddNodes SegmentType:=msoSegmentLine, _
 EditingType:=msoEditingAuto, X1:=100, Y1:=100

 ' Convert the polygon to a Shape object.
 .ConvertToShape
End With


Options.SaveAutoRecoverInfo Property (Publisher)

 Copy code hover
[image]

Options.SaveAutoRecoverInfo Property (Publisher)
Send feedback

True if Microsoft Publisher automatically saves publications for recovery if the application is unexpectedly shut down. Read/write Boolean.

Syntax

expression .SaveAutoRecoverInfo

expression A variable that represents a Options object.

Return Value

Boolean

Remarks

Use the SaveAutoRecoverInfoInterval property to specify how often auto recovery saves occur.

Example

This example enables the global auto recovery option and sets the save interval to every five minutes.

VBA Copy code Copy code
Sub SetAutoRecoverInfo()
 With Options
 .SaveAutoRecoverInfo = True
 .SaveAutoRecoverInfoInterval = 5
 End With
End Sub


Hyperlink.TargetType Property (Publisher)

 Copy code hover
[image]

Hyperlink.TargetType Property (Publisher)
Send feedback

Returns a PbHlinkTargetType constant that represents the type of hyperlink. Read-only.

Syntax

expression .TargetType

expression A variable that represents a Hyperlink object.

Return Value

PbHlinkTargetType

Remarks

The TargetType property value can be one of the following PbHlinkTargetType constants.

pbHlinkTargetTypeEmail

pbHlinkTargetTypeFirstPage

pbHlinkTargetTypeLastPage

pbHlinkTargetTypeNextPage

pbHlinkTargetTypeNone

pbHlinkTargetTypePageID

pbHlinkTargetTypePreviousPage

pbHlinkTargetTypeURL

Example

This example verifies that the specified hyperlink is a URL and, if it is, sets the hyperlink display text and address. This example assumes there is at least one shape on the first page of the active publication.

VBA Copy code Copy code
Sub SetHyperlinkTextToDisplay()
 With ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.Hyperlinks.Item(1)
 If .TargetType = pbHlinkTargetTypeURL Then
 .TextToDisplay = "Tailspin Toys Web Site"
 .Address = "http://www.tailspintoys.com/"
 End If
 End With
End Sub


Hyperlink Object (Publisher)

 Copy code hover
[image]

Hyperlink Object (Publisher)
Send feedback

Represents a hyperlink. The Hyperlink object is a member of the Hyperlinks collection and the Shape and ShapeRange objects.

Example

Use the Hyperlink property to return a Hyperlink object associated with a shape (a shape can have only one hyperlink). The following example deletes the hyperlink associated with the first shape in the active document.

Copy code Copy code
Sub DeleteHyperlink()
 ActiveDocument.Pages(1).Shapes(1).Hyperlink.Delete
End Sub

Use Hyperlinks(index), where index is the index number, to return a single Hyperlink object from a document, range, or selection. The following example deletes the first hyperlink in the selection.

Copy code Copy code
Sub DeleteSelectedHyperlink()
 If Selection.TextRange.Hyperlinks.Count >= 1 Then
 Selection.TextRange.Hyperlinks(1).Delete
 End If
End Sub

Use the Add method to add a hyperlink. The following example adds a hyperlink to the selected text.

Copy code Copy code
Sub AddHyperlinkToSelectedText()
 Selection.TextRange.Hyperlinks.Add Text:=Selection.TextRange, _
 Address:="http://www.tailspintoys.com/"
End Sub

Use the Address property to add or change the address to a hyperlink. The following example adds a shape to the active publication and then adds a hyperlink to the shape.

Copy code Copy code
Sub AddHyperlinkToShape()
 With ActiveDocument.Pages(1).Shapes.AddShape _
 (Type:=msoShape5pointStar, Left:=200, _
 Top:=200, Width:=300, Height:=300)
 .Hyperlink.Address = "http://www.tailspintoys.com/"
 End With
End Sub


MailMergeDataSource.Included Property (Publisher)

 Copy code hover
[image]

MailMergeDataSource.Included Property (Publisher)
Send feedback

True if a record is included in a mail merge. Read/write Boolean.

Syntax

expression .Included

expression A variable that represents an MailMergeDataSource object.

Return Value

Boolean

Remarks

Use the SetAllIncludedFlags method to set the included status for all mail merge records.

Example

This example searches the records to verify that the length of the PostalCode field for each record is at least five digits long. If it is not, the record is excluded from the mail merge and flagged as invalid.

Copy code Copy code
Sub ExcludeRecords()
 Dim intRecord As Integer
 With ActiveDocument.MailMerge
 For intRecord = 1 To .DataSource.RecordCount
 .DataSource.ActiveRecord = intRecord
 If Len(.DataSource.DataFields("PostalCode").Value) < 5 Then
 With .DataSource
 .Included = False
 .InvalidAddress = True
 .InvalidComments = "This record is removed " & _
 "from the mail merge because its postal code" & _
 "has less than five digits."
 End With
 End If
 Next
 End With
End Sub


View.ScrollShapeIntoView Method (Publisher)

 Copy code hover
[image]

View.ScrollShapeIntoView Method (Publisher)
Send feedback

Scrolls the publication window so that the specified shape is displayed in the publication window or pane.

Syntax

expression .ScrollShapeIntoView(Shape)

expression A variable that represents a View object.

Parameters

Name | Required/Optional | Data Type | Description
Shape | Required | Shape | The shape to scroll into view.

Example

This example adds a shape to a new page and scrolls the current view to the new shape.

Copy code Copy code
Sub ScrollIntoView()
 Dim shpStar As Shape
 Dim intWidth As Integer
 Dim intHeight As Integer

 With ActiveDocument
 intWidth = .PageSetup.PageWidth
 intWidth = (intWidth / 2) - 75
 intHeight = .PageSetup.PageHeight
 intHeight = (intHeight / 2) - 75

 With .Pages.Add(Count:=1, After:=ActiveDocument.Pages.Count)
 Set shpStar = .Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=intWidth, Top:=intHeight, Width:=150, Height:=150)
 shpStar.TextFrame.TextRange.Text = "New Star Shape"
 End With
 End With

 ActiveView.ScrollShapeIntoView Shape:=shpStar

End Sub


EmailMergeEnvelope.Bcc Property (Publisher)

 Copy code hover
[image]

EmailMergeEnvelope.Bcc Property (Publisher)
Send feedback

Gets or sets a semicolon-delimited list of e-mail addresses that receive a blind carbon copy (BCC) of the e-mail message. Read/write.

Version Information

Version Added: Publisher 2007

Syntax

expression .Bcc

expression A variable that represents an EmailMergeEnvelope object.

Return Value

String

Remarks

Set the Bcc property to a string of e-mail addresses separated by semicolons, as shown in the following example.

VBA Copy code Copy code
 MailMerge.EmailMergeEnvelope.Bcc = "name1@address1;name2@address2;name3@address3;..."


PageSize.TopMargin Property (Publisher)

 Copy code hover
[image]

PageSize.TopMargin Property (Publisher)
Send feedback

Specifies the distance between the top edge of the printer sheet and the top edge of the publication page for the blank page size represented by the parent PageSize object. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .TopMargin

expression A variable that represents a PageSize object.

Return Value

Variant

Remarks

The blank page size represented by the parent PageSize object corresponds to one of the icons displayed under Blank Page Sizes in the Page Setup dialog box in the Microsoft Publisher user interface.


TextRange.InsertDateTime Method (Publisher)

 Copy code hover
[image]

TextRange.InsertDateTime Method (Publisher)
Send feedback

Returns a TextRange object that represents the date and time inserted into a specified text range.

Syntax

expression .InsertDateTime(Format, InsertAsField, InsertAsFullWidth, Language, Calendar)

expression A variable that represents a TextRange object.

Parameters

Name | Required/Optional | Data Type | Description
Format | Required | PbDateTimeFormat | A format for the date and time.
InsertAsField | Optional | Boolean | True for Microsoft Publisher to update date and time whenever opening the publication. Default is False.
InsertAsFullWidth | Optional | Boolean | True to insert the specified information as double-byte digits. This argument may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed. Default is False.
Language | Optional | MsoLanguageID | The language in which to display the date or time.
Calendar | Optional | PbCalendarType | The calendar type to use when displaying the date or time.

Return Value

TextRange

Remarks

The Format parameter can be one of the PbDateTimeFormat constants declared in the Microsoft Publisher type library.

The Language parameter can be one of the MsoLanguageID constants declared in the Microsoft Office type library.

The Calendar parameter can be one of the PbCalendarType constants declared in the Microsoft Publisher type library. The default is pbCalendarTypeWestern.

Example

This example inserts a field for the current date at the cursor position.

VBA Copy code Copy code
Sub InsertDateField()
 Selection.TextRange.InsertDateTime Format:=pbDateLong, InsertAsField:=True
End Sub


Document.PageSetup Property (Publisher)

 Copy code hover
[image]

Document.PageSetup Property (Publisher)
Send feedback

Returns a PageSetup object representing a publication's page size, page layout and paper settings. Read-only.

Syntax

expression .PageSetup

expression A variable that represents a Document object.

Return Value

PageSetup

Remarks

You can only use the PageSetup property when printing multiple pages on a single sheet of printer paper. If the page size is greater than half the paper size, Microsoft Publisher will display an error.

Example

This example specifies page setup options for a publication with multiple publication pages printed on each sheet of printer paper.

VBA Copy code Copy code
Sub SetTopMargin()
 With ActiveDocument.PageSetup
 .PageHeight = InchesToPoints(5)
 .PageWidth = InchesToPoints(8)
 .MultiplePagesPerSheet = True
 .TopMargin = InchesToPoints(0.25)
 .LeftMargin = InchesToPoints(0.25)
 End With
End Sub


PbHelpType Enumeration (Publisher)

 Copy code hover
[image]

PbHelpType Enumeration (Publisher)
Send feedback

The type of help to display.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbHelp | 1 | Displays the Help Topics dialog box.
pbHelpActiveWindow | 2 | Displays Help describing the command associated with the active view or pane.
pbHelpPSSHelp | 3 | Displays product support information.


Window.Caption Property (Publisher)

 Copy code hover
[image]

Window.Caption Property (Publisher)
Send feedback

Returns or sets a String indicating the caption at the top of the Microsoft Publisher application window. Read/write.

Syntax

expression .Caption

expression A variable that represents a Window object.

Return Value

String

Example

The following example demonstrates how a subroutine could temporarily change the Publisher window caption and then restore it afterward.

Copy code Copy code
Sub WindowCaption()
 Dim strCaption As String

 strCaption = ActiveWindow.Caption

 ActiveWindow.Caption = "Custom process--please wait..."

 ' Run custom code here.

 ActiveWindow.Caption = strCaption
End Sub


Shape.CatalogMergeItems Property (Publisher)

 Copy code hover
[image]

Shape.CatalogMergeItems Property (Publisher)
Send feedback

Returns a CatalogMergeShapes collection that represents the shapes included in the catalog merge area. Read-only.

Syntax

expression .CatalogMergeItems

expression A variable that represents a Shape object.

Return Value

CatalogMergeShapes

Remarks

The catalog merge area can contain picture and text data fields you have inserted, in addition to other design elements you choose.

Example

The following example tests whether any page in the specified publication contains a catalog merge area and, if it does, it returns a list of the shapes it contains.

Copy code Copy code
Sub ListCatalogMergeAreaContents()

 Dim pgPage As Page
 Dim mmLoop As Shape
 Dim intCount As Integer

 For Each pgPage In ThisDocument.Pages
 For Each mmLoop In pgPage.Shapes

 If mmLoop.Type = pbCatalogMergeArea Then

 With mmLoop.CatalogMergeItems
 For intCount = 1 To .Count
 Debug.Print "Shape ID: " & _
 mmLoop.CatalogMergeItems.Item(intCount).ID
 Debug.Print "Shape Name: " & _
 mmLoop.CatalogMergeItems.Item(intCount).Name
 Next
 End With

 End If

 Next mmLoop
 Next pgPage

End Sub


Document.UndoActionsAvailable Property (Publisher)

 Copy code hover
[image]

Document.UndoActionsAvailable Property (Publisher)
Send feedback

Returns the number of actions available on the undo stack. Read-only Long.

Syntax

expression .UndoActionsAvailable

expression A variable that represents an Document object.

Return Value

Long

Example

The following example adds a rectangle that contains a text frame to the fourth page of the active publication. Some font properties and the text of the text frame are set. A test is then run to determine whether the font in the text frame is Courier. If so, the Undo method is used with the value of the UndoActionsAvailable property passed as a parameter to specify that all previous actions be undone.

The Redo method is then used with the value of the RedoActionsAvailable property minus 2 passed as a parameter to redo all actions except for the last two. A new font is specified for the text in the text frame, in addition to new text.

This example assumes the active document contains at least four pages.

VBA Copy code Copy code
Dim thePage As page
Dim theShape As Shape
Dim theDoc As Publisher.Document

Set theDoc = ActiveDocument
Set thePage = theDoc.Pages(4)

With theDoc
 With thePage
 Set theShape = .Shapes.AddShape(msoShapeRectangle, _
 75, 75, 190, 30)
 With theShape.TextFrame.TextRange
 .Font.Size = 12
 .Font.Name = "Courier"
 .Text = "This font is Courier."
 End With
 End With

 If thePage.Shapes(1).TextFrame.TextRange.Font.Name = "Courier" Then
 .Undo (.UndoActionsAvailable)
 .Redo (.RedoActionsAvailable - 2)
 With theShape.TextFrame.TextRange
 .Font.Name = "Verdana"
 .Text = "This font is Verdana."
 End With
 End If
End With


Wizard.Name Property (Publisher)

 Copy code hover
[image]

Wizard.Name Property (Publisher)
Send feedback

Returns a String value indicating the name of the specified object. Read-only.

Syntax

expression .Name

expression A variable that represents a Wizard object.

Remarks

You can use an object's name in conjunction with the Item method or Item property to return a reference to the object if the Item method or property for the collection that contains the object takes a Variant argument. For example, if the value of the Name property for a shape is Rectangle 2, then .Shapes("Rectangle 2") will return a reference to that shape.

The Name property is the default property for the BorderArt, BorderArtFormat, and Label objects.


AdvancedPrintOptions.GraphicsResolution Property (Publisher)

 Copy code hover
[image]

AdvancedPrintOptions.GraphicsResolution Property (Publisher)
See also Send feedback

Returns or sets a PbPrintGraphics constant representing the resolution at which the inserted graphics are to be printed in the specified publication. Read/write.

Syntax

expression .GraphicsResolution

expression A variable that represents a AdvancedPrintOptions object.

Return Value

PbPrintGraphics

Remarks

Setting this property only affects inserted pictures (whether linked or embedded), and clip art. Autoshapes and border art will always be printed.

Printing boxes in place of graphics is useful when printing a quick proof of the layout that only shows the positioning of pictures.

This property corresponds to the Graphics controls on the Graphics and Fonts tab of the Advanced Print Settings dialog box.

The GraphicsResolution property value can be one of the PbPrintGraphics constants declared in the Microsoft Publisher type library.

Example

The following example sets the graphics to print as boxes in the active publication.

VBA Copy code Copy code
Sub PrintGraphicAsBoxes
 With ActiveDocument.AdvancedPrintOptions
 If .GraphicsResolution <> pbPrintNoGraphics Then
 .GraphicsResolution = pbPrintNoGraphics
 End If
 End With
End Sub

See also

Concepts

AdvancedPrintOptions Object

Other resources

AdvancedPrintOptions Object Members


Documents.Add Method (Publisher)

 Copy code hover
[image]

Documents.Add Method (Publisher)
Send feedback

Adds a new Document object that represents a new publication to the Documents collection.

Syntax

expression .Add(PbWizard, desid)

expression An expression that returns a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
PbWizard | Optional | PbWizard | The wizard to use to create the new publication.
desid | Optional | Long | The ID of the design to apply to the new publication.

Return Value

Document

Remarks

The PbWizard parameter value should be a constant from the PbWizard enumeration, declared in the Microsoft Publisher 2007 type library.

The desid parameter value should be the ID of the design to apply. You can determine the design ID by creating a new publication that uses the wizard and design you want in the Publisher user interface and then running the following Visual Basic for Applications (VBA) macro.

VBA Copy code Copy code
Public Sub FindDesignID()

 Dim pbWizard As Wizard
 Dim pbWizardProperty As WizardProperty

 Set pbWizard = ThisDocument.Wizard
 Set pbWizardProperty = pbWizard.Properties(1)

 Debug.Print pbWizardProperty.CurrentValueId

End Sub


Font.SizeBi Property (Publisher)

 Copy code hover
[image]

Font.SizeBi Property (Publisher)
Send feedback

Returns or sets a Variant value representing the size, in points, of the Font object for text in a right-to-left language. Valid range is 0.5 points to 999.5 points. Read/write.

Syntax

expression .SizeBi

expression A variable that represents a Font object.

Return Value

Variant

Example

This example tests the text in the second story. If it is in a right-to-left language, larger than 12 point, and italic, the text is set to bold.

VBA Copy code Copy code
Sub SizeBiIfBig()

 Dim fntSize As Font

 Set fntSize = Application.ActiveDocument.Stories(2).TextRange.Font
 With fntSize
 If .SizeBi > 12 And .ItalicBi = msoTrue Then
 .BoldBi = msoTrue
 Else
 MsgBox "The font size is 12 points or less " & _
 ", not bold, or this is not in a right-to-left language."
 End If
 End With

End Sub


Selection Object (Publisher)

 Copy code hover
[image]

Selection Object (Publisher)
Send feedback

Represents the current selection in a window or pane. A selection represents either a selected (or highlighted) area in the publication, or it represents the cursor if nothing in the publication is selected. There can only be one Selection object per publication window pane, and only one Selection object in the entire application can be active.

Example

Use the Selection property to return the Selection object. If no object qualifier is used with the Selection property, Microsoft Publisher returns the selection from the active pane of the active publication window. The following example copies the current selection from the active publication.

Copy code Copy code
Sub CopySelection()
 Selection.ShapeRange.Copy
End Sub

The following example determines what type of item is selected and, if it is an autoshape, fills the first shape in the selection with color. This example assumes there is at least one item selected in the active pubication.

Copy code Copy code
Sub SelectedShape()
 If Selection.Type = pbSelectionShape Then
 Selection.ShapeRange.Item(1).Fill.ForeColor _
 .RGB = RGB(Red:=200, Green:=20, Blue:=255)
 End If
End Sub

The following example copies the selection and pastes it into the first shape on the second page of the active publication.

Copy code Copy code
Sub CopyPasteSelection()
 Selection.TextRange.Copy
 With ActiveDocument.Pages(2).Shapes(1).TextFrame.TextRange
 .Collapse Direction:=pbCollapseEnd
 .InsertAfter NewText:=vbLf
 .Paste
 End With
End Sub


ThreeDFormat.RotationX Property (Publisher)

 Copy code hover
[image]

ThreeDFormat.RotationX Property (Publisher)
Send feedback

Returns or sets the rotation of the extruded shape around the x-axis in degrees. Can be a value from - 90 through 90. A positive value indicates upward rotation; a negative value indicates downward rotation. Read/write Single.

Syntax

expression .RotationX

expression A variable that represents a ThreeDFormat object.

Return Value

Single

Remarks

To set the rotation of the extruded shape around the y-axis, use the RotationY property of the ThreeDFormat object. To set the rotation of the extruded shape around the z-axis, use the Rotation property of the Shape object. To change the direction of the extrusion's sweep path without rotating the front face of the extrusion, use the SetExtrusionDirection method.

Example

This example adds three identical extruded ovals to the active document and sets their rotation around the x-axis to - 30, 0, and 30 degrees, respectively.

VBA Copy code Copy code
Sub SetRotationX()
 With ActiveDocument.Pages(1).Shapes
 With .AddShape(Type:=msoShapeOval, Left:=30, _
 Top:=60, Width:=50, Height:=25).ThreeD
 .Visible = True
 .RotationX = -30
 End With
 With .AddShape(Type:=msoShapeOval, Left:=90, _
 Top:=60, Width:=50, Height:=25).ThreeD
 .Visible = True
 .RotationX = 0
 End With
 With .AddShape(Type:=msoShapeOval, Left:=150, _
 Top:=60, Width:=50, Height:=25).ThreeD
 .Visible = True
 .RotationX = 30
 End With
 End With
End Sub


PageSetup.PageHeight Property (Publisher)

 Copy code hover
[image]

PageSetup.PageHeight Property (Publisher)
Send feedback

Returns or sets a Variant that represents the height of the pages in a publication. Read/write.

Version Information

Version Added: Publisher 2007

Syntax

expression .PageHeight

expression A variable that represents a PageSetup object.

Return Value

Variant

Remarks

Numeric values are evaluated as points. String values can be in any unit supported by Microsoft Publisher (for example, "2.5 in"). The valid range of possible values is from zero to the difference between the sheet height and the page height.

Example

This example specifies a height of five inches for the pages in the active publication.

VBA Copy code Copy code
Public Sub PageHeight_Example()
 ActiveDocument.PageSetup.PageHeight = InchesToPoints(5)
End Sub


TextRange.Fields Property (Publisher)

 Copy code hover
[image]

TextRange.Fields Property (Publisher)
Send feedback

Returns a Fields object that represents all the fields in the specified text range.

Syntax

expression .Fields

expression A variable that represents a TextRange object.

Return Value

Fields

Example

This example makes the first field in the first shape on the first page of the active publication bold.

Copy code Copy code
Sub CountFields()
 ActiveDocument.Pages(1).Shapes(1).TextFrame _
 .TextRange.Fields(1).TextRange.Font.Bold = msoTrue
End Sub


WebListBoxItems.Delete Method (Publisher)

 Copy code hover
[image]

WebListBoxItems.Delete Method (Publisher)
Send feedback

Deletes the specified hidden Web field or Web list box item object.

Syntax

expression .Delete(Index)

expression A variable that represents a WebListBoxItems object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The number of the Web field or list box item to delete.


ShapeRange.LinkFormat Property (Publisher)

 Copy code hover
[image]

ShapeRange.LinkFormat Property (Publisher)
Send feedback

Returns a LinkFormat object that contains the properties that are unique to linked OLE objects. Read-only.

Syntax

expression .LinkFormat

expression A variable that represents a ShapeRange object.

Example

This example updates the links between any OLE objects on page one in the active publication and their source files.

Copy code Copy code
Dim sh As Shape

For Each sh In ActiveDocument.Pages(1).Shapes
 If sh.Type = pbLinkedOLEObject Then
 With sh.LinkFormat
 .Update
 End With
 End If
Next


WebOptionButton Members (Publisher)

 Copy code hover
[image]

WebOptionButton Members (Publisher)
Send feedback

Represents a Web option button control. The WebOptionButton object is a member of the Shape object.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
ReturnDataLabel | Returns or sets a String that represents the text used by the Web page to label the specified Web object when the page is submitted. Read/write.
Selected | Specifies whether a Web check box or option button is selected. Read/write.
Value | Returns or sets a String that represents the value of a Web check box or option button. Read/write.


Printer Properties (Publisher)

 Copy code hover
[image]

Printer Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the creator of the parent Printer object. Read-only.
DriverType | Specifies the type of driver supported by the printer. Read-only.
Index | Returns a Long that represents the position of a particular printer in a specified printer collection.
IsActivePrinter | Gets or sets the printer represented by the parent Printer object as the active printer. Read/write.
IsColor | Returns True if the device represented by the parent Printer object is a color printer. Read-only.
IsDuplex | Returns True if the device represented by the parent Printer object is a duplex printer. Read-only.
PaperHeight | Gets or sets the height of the printed page in points. Read/write.
PaperOrientation | Gets or sets page orientation (landscape or portrait) for the printer. Read/write.
PaperSize | Returns the paper size setting found on the Publication and Paper Settings tab in the Print Setup dialog box in the Microsoft Publisher user interface (File menu). Read-only.
PaperSource | Returns the paper source setting found on the Publication and Paper Settings tab in the Print Setup dialog box in the Microsoft Publisher user interface (File menu). Read-only.
PaperWidth | Gets or sets the width of a printed page in points. Read/write.
Parent | Returns the parent of the Printer object. Read-only.
PrintableRect | Returns a PrintableRect object that represents the printer sheet area within which the specified printer will print. Read-only.
PrinterName | Gets the name of the printer represented by the parent Printer object. Read-only.
PrintMode | Read/write


FindReplace Methods (Publisher)

 Copy code hover
[image]

FindReplace Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Clear | Removes the specified search criteria in a find or replace operation.
Execute | Performs the specified Find or Replace operation.


ShadowFormat.RotateWithShape Property (Publisher)

 Copy code hover
[image]

ShadowFormat.RotateWithShape Property (Publisher)
See also Send feedback

Returns or sets an MsoTriState constant that represents whether to rotate the shadow when rotating the shape. Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .RotateWithShape

expression A variable that represents a ShadowFormat object.

Return value

MSOTRISTATE

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


TabStop Members (Publisher)

 Copy code hover
[image]

TabStop Members (Publisher)
Send feedback

Represents a single tab stop. The TabStop object is a member of the TabStops collection. The TabStops collection represents all the custom and default tab stops in a paragraph or group of paragraphs.

Methods

Name | Description
Clear | Removes the specified custom tab stop.

Properties

Name | Description
Alignment | Returns or sets a PbTabAlignmentType constant that represents the alignment for the specified tab stop. Read/write.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Leader | Sets or returns a PbTabLeaderType constant that represents the leader character for a tab stop. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Position | Returns or sets a Variant representing the font position relative to the baseline of the text in the specified range. Positive values move the text above the normal baseline, negative values move the text below the baseline. Indeterminate values are returned as -9999.0. Read/write.


MailMergeDataField.Creator Property (Publisher)

 Copy code hover
[image]

MailMergeDataField.Creator Property (Publisher)
Send feedback

Returns a Long that represents the application in which the specified object was created. For example, if the object was created in Microsoft Publisher, this property returns the hexadecimal number 4D505542, which represents the string "MSPB." This value can also be represented by the constant.

Syntax

expression .Creator

expression A variable that represents a MailMergeDataField object.


CalloutFormat Object (Publisher)

 Copy code hover
[image]

CalloutFormat Object (Publisher)
Send feedback

Contains properties and methods that apply to line callouts.

Example

Use the Callout property to return a CalloutFormat object. The following example adds a callout to the active publication, adds text to the callout, then specifies the following attributes for the callout:

  • a vertical accent bar that separates the text from the callout line (Accent property)

  • the angle between the callout line and the side of the callout text box will be 30 degrees (Angle property)

  • there will be no border around the callout text (Border property)

  • the callout line will be attached to the top of the callout text box (PresetDrop method)

  • the callout line will contain three segments (Type property)

Copy code Copy code
Sub AddFormatCallout()
 With ActiveDocument.Pages(1).Shapes.AddCallout(Type:=msoCalloutOne, _
 Left:=150, Top:=150, Width:=200, Height:=100)
 With .TextFrame.TextRange
 .Text = "This is a callout."
 With .Font
 .Name = "Stencil"
 .Bold = msoTrue
 .Size = 30
 End With
 End With
 With .Callout
 .Accent = MsoTrue
 .Angle = msoCalloutAngle30
 .Border = MsoFalse
 .PresetDrop msoCalloutDropTop
 .Type = msoCalloutThree
 End With
 End With
End Sub


ShapeNodes Methods (Publisher)

 Copy code hover
[image]

ShapeNodes Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified shape node object.
Insert | Inserts a new segment after the specified node of the freeform drawing.
Item | Returns an individual object in a specified collection.
SetEditingType | Sets the editing type of the specified node. If the node is a control point for a curved segment, this method sets the editing type of the node adjacent to it that joins two segments. Depending on the editing type, this method may affect the position of adjacent nodes.
SetPosition | Sets the position of the specified node. Depending on the editing type of the node, this method may affect the position of adjacent nodes.
SetSegmentType | Sets the segment type of the segment that follows the specified node. If the node is a control point for a curved segment, this method sets the segment type for that curve; this may affect the total number of nodes by inserting or deleting adjacent nodes.


PictureFormat.IsGreyScale Property (Publisher)

 Copy code hover
[image]

PictureFormat.IsGreyScale Property (Publisher)
Send feedback

Returns a MsoTriState constant that indicates whether the picture is a greyscale image. Read-only.

Syntax

expression .IsGreyScale

expression A variable that represents an PictureFormat object.

Return Value

MsoTriState

Remarks

The IsGreyScale property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The picture is not a greyscale image.
msoTriStateMixed | Indicates a combination of msoTrue and msoFalse for the specified shape range.
msoTrue | The specified picture is a greyscale image.

Example

The following example returns a list of the greyscale pictures contained in the active publication.

VBA Copy code Copy code
Sub ListGreyScalePictures()
Dim pgLoop As Page
Dim shpLoop As Shape

 For Each pgLoop In ActiveDocument.Pages
 For Each shpLoop In pgLoop.Shapes

 If shpLoop.Type = pbPicture Or shpLoop.Type = pbLinkedPicture Then

 With shpLoop.PictureFormat
 If .IsEmpty = msoFalse And .IsGreyScale = msoCTrue Then

 Debug.Print .Filename
 Debug.Print "Page " & pgLoop.PageNumber

 End If
 End With

 End If

 Next shpLoop
 Next pgLoop

End Sub


Document Methods (Publisher)

 Copy code hover
[image]

Document Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
BeginCustomUndoAction | Specifies the starting point and label (textual description) of a group of actions that are wrapped to create a single undo action. The EndCustomUndoAction method is used to specify the endpoint of the actions used to create the single undo action. The wrapped group of actions can be undone with a single undo.
ChangeDocument | Changes the current publication to one that uses the wizard, and optionally the design, that you specify.
Close | Closes the current publication and creates a blank publication in its place.
ConvertPublicationType | Converts the specified publication to the specified publication type.
EndCustomUndoAction | Specifies the endpoint of a group of actions that are wrapped to create a single undo action. The BeginCustomUndoAction Method method is used to specify the starting point and label (textual description) of the actions used to create the single undo action. The wrapped group of actions can be undone with a single undo.
ExportAsFixedFormat | Saves a Microsoft Publisher publication in PDF or XPS format. The conversion readies the document to be sent to commercial presses, to copy shops, for desktop printing, or for electronic distribution.
FindShapeByWizardTag | Returns a ShapeRange object representing one or all of the shapes placed in a publication by a wizard and bearing the specified wizard tag.
FindShapesByTag | Returns a ShapeRange object that represents the shapes with the specified tag.
PrintOutEx | Prints all or part of the specified publication.
Redo | Redoes the last action or a specified number of actions. Corresponds to the list of items that appears when you click the arrow beside the Redo button on the Standard toolbar. Calling this method reverses the Undo Method method.
Save | Saves the specified publication.
SaveAs | Saves the specified publication with a new name or format.
SetBusinessInformation | Applies the specified business information set, which consists of a logo image and business contact information (such as the company name and address), to the current publication.
Undo | Undoes the last action or a specified number of actions. Corresponds to the list of items that appears when you click the arrow beside the Undo button on the Standard toolbar.
UndoClear | Clears the list of actions that can be undone for the specified publication. Corresponds to the list of items that appears when you click the arrow beside the Undo button on the Standard toolbar.
UpdateOLEObjects | Updates linked and embedded OLE objects.
WebPagePreview | Generates a Web page preview of the specified publication in Internet Explorer.


MailMergeDataSource.EditRecord Method (Publisher)

 Copy code hover
[image]

MailMergeDataSource.EditRecord Method (Publisher)
Send feedback

Changes one of the data fields in one of the records in the master data source (the combined mail-merge recipient list).

Version Information

Version Added: Publisher 2007

Syntax

expression .EditRecord(lRec, varField, Value)

expression A variable that represents a MailMergeDataSource object.

Parameters

Name | Required/Optional | Data Type | Description
lRec | Required | Long | The ID of the record you want to edit.
varField | Required | Variant | The data field (column) that contains the value you want to change.
Value | Required | Variant | The value to be changed.

Remarks

You can use the EditRecord method to correct data source information that is in error, such as an outdated recipient address.

The EditRecord method does not make any changes to the individual data sources that together make up the master data source.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the EditRecord method to change the value of a single column in a particular record in the master data source (the combined mail-merge recipient list).

Before running this macro, replace recordID with the index number of the record in the data source that you want to edit; replace fieldname with the name of the field (column) in the record that you want to edit; and replace value with the new value you want to set for the field.

VBA Copy code Copy code
Public Sub EditRecord_Example()

 Dim pubMailMergeDataSource As Publisher.MailMergeDataSource

 Set pubMailMergeDataSource = ThisDocument.MailMerge.DataSource

 pubMailMergeDataSource.EditRecord recordID, "fieldname", "value"

End Sub


PbWizard Enumeration (Publisher)

 Copy code hover
[image]

PbWizard Enumeration (Publisher)
Send feedback

The wizard to use to create the new publication.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbWizardAdvertisements | 12 | Creates advertisements
pbWizardAirplanes | 23 | Creates airplanes
pbWizardBanners | 21 | Creates banners
pbWizardBrochures | 8 | Creates brochures
pbWizardBusinessCards | 3 | Creates business cards
pbWizardBusinessForms | 20 | Creates business forms
pbWizardCalendars | 13 | Creates calendars
pbWizardCatalogs | 161 | Creates catalogs
pbWizardCertificates | 62 | Creates certificates
pbWizardEmailActivityEvent | 302 | Creates e-mail activity events
pbWizardEmailAutomatic | 305 | Creates e-mail messages automatically
pbWizardEmailFeaturedProduct | 304 | Creates e-mail messages for featured products
pbWizardEmailLetter | 300 | Creates e-mail letters
pbWizardEmailNewsletter | 39 | Creates e-mail newsletters
pbWizardEmailProductList | 303 | Creates e-mail product lists
pbWizardEmailSpeakerEvent | 301 | Creates e-mail speaker event
pbWizardEnvelopes | 7 | Creates envelopes
pbWizardFlyers | 16 | Creates flyers
pbWizardGiftCertificates | 63 | Creates gift certificates
pbWizardGreetingCard | 40 | Creates greeting cards
pbWizardInvitation | 41 | Creates invitations
pbWizardJapaneseAdvertisements | 165 | Creates Japanese advertisements
pbWizardJapaneseAirplanes | 164 | Creates Japanese airplanes
pbWizardJapaneseBanners | 121 | Creates Japanese banners
pbWizardJapaneseBrochures | 92 | Creates Japanese brochures
pbWizardJapaneseBusinessCards | 91 | Creates Japanese business cards
pbWizardJapaneseBusinessForms | 123 | Creates Japanese business forms
pbWizardJapaneseCalendars | 82 | Creates Japanese calendars
pbWizardJapaneseCatalogs | 177 | Creates Japanese catalogs
pbWizardJapaneseCertificates | 119 | Creates Japanese certificates
pbWizardJapaneseEnvelopes | 93 | Creates Japanese envelopes
pbWizardJapaneseFlyers | 94 | Creates Japanese flyers
pbWizardJapaneseGiftCertificates | 122 | Creates Japanese gift certificates
pbWizardJapaneseGreetingCards | 80 | Creates Japanese greeting cards
pbWizardJapaneseInvitations | 81 | Creates Japanese invitations
pbWizardJapaneseLabels | 118 | Creates Japanese labels
pbWizardJapaneseLetterheads | 95 | Creates Japanese letterheads
pbWizardJapaneseMenus | 116 | Creates Japanese menus
pbWizardJapaneseNewsletters | 117 | Creates Japanese newsletters
pbWizardJapaneseOrigami | 163 | Creates Japanese Origami
pbWizardJapanesePostcards | 78 | Creates Japanese postcards
pbWizardJapanesePrograms | 115 | Creates Japanese programs
pbWizardJapaneseSigns | 149 | Creates Japanese signs
pbWizardJapaneseWebSites | 120 | Creates Japanese Web sites
pbWizardLabels | 19 | Creates labels
pbWizardLetterheads | 6 | Creates letterheads
pbWizardMenus | 59 | Creates menus
pbWizardNewsletters | 9 | Creates newsletters
pbWizardNone | 0 | Default
pbWizardOrigami | 22 | Creates Origami
pbWizardPostcards | 10 | Creates postcards
pbWizardPrograms | 76 | Creates programs
pbWizardQuickPublications | 179 | Creates QuickPublications
pbWizardResumes | 18 | Creates resumes
pbWizardSigns | 17 | Creates signs
pbWizardWebSiteBlank | 203 | Creates a blank Web site
pbWizardWebSiteHomePage | 5 | Creates a home page for a Web site
pbWizardWebSiteProductSales | 201 | Creates a product sales Web site
pbWizardWebSiteServices | 202 | Creates a services Web site
pbWizardWebSiteThreePage | 200 | Creates a three-page Web site
pbWizardWithComplimentsCards | 73 | Creates with compliments cards
pbWizardWordDocument | 189 | Creates a Microsoft Office Word document


FillFormat.PresetGradientType Property (Publisher)

 Copy code hover
[image]

FillFormat.PresetGradientType Property (Publisher)
Send feedback

Returns an MsoPresetGradientType constant that represents the preset gradient type for the specified fill. Read-only.

Syntax

expression .PresetGradientType

expression A variable that represents a FillFormat object.

Return Value

MsoPresetGradientType

Remarks

The PresetGradientType property value can be one of the MsoPresetGradientType constants declared in the Microsoft Office type library.

Use the PresetGradient method to set the preset gradient type for the fill.

Example

This example changes the fill for the first shape on the first page of the active publication to the Fog preset gradient fill if it is not already set to the Fog preset gradient. This example assumes that there is at least one shape on the first page of the active publication.

VBA Copy code Copy code
Sub SetGradient()
 With ActiveDocument.Pages(1).Shapes(1).Fill
 If .PresetGradientType <> msoGradientFog Then
 .PresetGradient Style:=msoGradientHorizontal, _
 Variant:=1, PresetGradientType:=msoGradientFog
 End If
 End With
End Sub


ParagraphFormat.ListBulletFontSize Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.ListBulletFontSize Property (Publisher)
Send feedback

Sets or retrieves a Single that represents the list bullet font size from the specified paragraphs. Read/write.

Syntax

expression .ListBulletFontSize

expression A variable that represents a ParagraphFormat object.

Return Value

Single

Remarks

Returns an "Access Denied" message if the list is not a bulleted list.

Example

This example tests to see if the list type is a bulleted list. If it is, the ListFontSize is set to 24 and the ListBulletFontName is set to "Verdana".

Copy code Copy code
Dim objParaForm As ParagraphFormat

Set objParaForm = ActiveDocument.Pages(1).Shapes(1) _
.TextFrame.TextRange.ParagraphFormat

With objParaForm
 If .ListType = pbListTypeBullet Then
 .ListBulletFontSize = 24
 .ListBulletFontName = "Verdana"
 End If
End With


ShadowFormat.ForeColor Property (Publisher)

 Copy code hover
[image]

ShadowFormat.ForeColor Property (Publisher)
Send feedback

Returns or sets a ColorFormat object representing the foreground color for the fill, line, or shadow. Read/write.

Syntax

expression .ForeColor

expression A variable that represents a ShadowFormat object.

Remarks

Use the BackColor property to set the background color for a fill or line.

Example

This example adds a rectangle to the active publication and then sets the foreground color, background color, and gradient for the rectangle's fill.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes.AddShape _
 (Type:=msoShapeRectangle, _
 Left:=90, Top:=90, Width:=90, Height:=50).Fill
 .ForeColor.RGB = RGB(128, 0, 0)
 .BackColor.RGB = RGB(170, 170, 170)
 .TwoColorGradient msoGradientHorizontal, 1
End With

This example adds a patterned line to the active publication.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes.AddLine _
 (BeginX:=10, BeginY:=100, EndX:=250, EndY:=0).Line
 .Weight = 6
 .ForeColor.RGB = RGB(0, 0, 255)
 .BackColor.RGB = RGB(128, 0, 0)
 .Pattern = msoPatternDarkDownwardDiagonal
End With


Shape.PictureFormat Property (Publisher)

 Copy code hover
[image]

Shape.PictureFormat Property (Publisher)
Send feedback

Returns a PictureFormat object that contains picture formatting properties for the specified object. Applies to Shape or ShapeRange objects that represent pictures or OLE objects. Read-only.

Syntax

expression .PictureFormat

expression A variable that represents a Shape object.

Example

This example sets the brightness and contrast for all pictures on the first page of the active publication.

Copy code Copy code
Sub FixPictureContrastBrightness()
 Dim shp As Shape
 For Each shp In ActiveDocument.Pages(1).Shapes
 If shp.Type = pbPicture Then
 With shp.PictureFormat
 .Brightness = 0.6
 .Contrast = 0.6
 End With
 End If
 Next shp
End Sub


CatalogMergeShapes.VerticalRepeat Property (Publisher)

 Copy code hover
[image]

CatalogMergeShapes.VerticalRepeat Property (Publisher)
Send feedback

Returns a Long that represents the number of times the catalog merge area will repeat down the target publication page when the catalog merge is executed. Read-only.

Syntax

expression .VerticalRepeat

expression A variable that represents a CatalogMergeShapes object.

Return Value

Long

Remarks

When the catalog merge is executed, the catalog merge area repeats once for each selected record in the specified data source.

The number of times the catalog merge area repeats down the page is determined by the height of the area. Use the Height property of the Shape object to return or set the vertical size of the catalog merge area.

The HorizontalRepeat property of the CatalogMergeShapes object represents the number of times the catalog merge area repeats horizontally across the target publication page.

Example

The following example returns the number of times the catalog merge area will repeat horizontally and vertically on the target publication page when the catalog merge is performed. This example assumes the catalog merge area is the first shape on the first page of the specified publication.

VBA Copy code Copy code
Sub CatalogMergeDimensions()

 With ThisDocument.Pages(1).Shapes(1)
 Debug.Print .Width
 Debug.Print .CatalogMergeItems.HorizontalRepeat
 Debug.Print .Height
 Debug.Print .CatalogMergeItems.VerticalRepeat
 End With

End Sub


Row.Cells Property (Publisher)

 Copy code hover
[image]

Row.Cells Property (Publisher)
Send feedback

Returns a CellRange object that represents the cell or cells in row of a table.

Syntax

expression .Cells

expression A variable that represents a Row object.

Example

This example merges the first and second cells in the first column of the specified table.

VBA Copy code Copy code
Sub MergeCell()
 With ActiveDocument.Pages(1).Shapes(2).Table.Columns(1)
 .Cells(1).Merge MergeTo:=.Cells(2)
 End With
End Sub

This example applies a thick border outline to the first cell in the second column of the specified table.

VBA Copy code Copy code
Sub OutlineBorderCell()
 With ActiveDocument.Pages(1).Shapes(2).Table.Columns(2).Cells(1)
 .BorderLeft.Weight = 5
 .BorderRight.Weight = 5
 .BorderTop.Weight = 5
 .BorderBottom.Weight = 5
 End With
End Sub


BuildingBlock.Name Property (Publisher)

 Copy code hover
[image]

BuildingBlock.Name Property (Publisher)
Send feedback

A string that represents the unique name of the building block. Read/write.

Syntax

expression .Name

expression A variable that represents a BuildingBlock object.


Application.Assistance Property (Publisher)

 Copy code hover
[image]

Application.Assistance Property (Publisher)
See also Send feedback

Gets a reference to the Microsoft Office (MSO) IAssistance object, which provides a means for developers to create a customized Help experience for users within Microsoft Office. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .Assistance

expression A variable that represents an Application object.

Remarks

The IAssistance object exposes methods that developers can use to display Help topics in the Office Help Viewer or to display Help topics that ship with Microsoft Office in the Publisher Help window.

See also

Concepts

Application Object

Other resources

Application Object Members


OLEFormat.Parent Property (Publisher)

 Copy code hover
[image]

OLEFormat.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents an OLEFormat object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


CellBorder Members (Publisher)

 Copy code hover
[image]

CellBorder Members (Publisher)
Send feedback

Represents the color and weight settings for cell borders.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Color | Returns a ColorFormat object representing the color information for the specified object.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Weight | Returns or sets a Variant indicating the thickness of the specified line or cell border.


TextStyle.NextParagraphStyle Property (Publisher)

 Copy code hover
[image]

TextStyle.NextParagraphStyle Property (Publisher)
Send feedback

Returns or sets a String that represents the paragraph style that follows the specified text style when a user presses ENTER. Read/write.

Syntax

expression .NextParagraphStyle

expression A variable that represents a TextStyle object.

Return Value

String

Example

This example creates a new text style and specifies that the text style following the new text style is the Normal style.

Copy code Copy code
Sub CreateNewTextStyle()
 Dim styNew As TextStyle
 Dim fntStyle As Font

 Set styNew = ActiveDocument.TextStyles.Add(StyleName:="Heading 1")
 Set fntStyle = styNew.Font

 With fntStyle
 .Name = "Tahoma"
 .Bold = msoTrue
 .Size = 15
 End With

 With styNew
 .Font = fntStyle
 .NextParagraphStyle = "Normal"
 End With
End Sub


ShadowFormat.OffsetX Property (Publisher)

 Copy code hover
[image]

ShadowFormat.OffsetX Property (Publisher)
Send feedback

Returns or sets a Variant value indicating the vertical offset of the shadow from the specified shape. A positive value offsets the shadow below the shape; a negative value offsets it above the shape. Read/write.

Syntax

expression .OffsetX

expression A variable that represents an ShadowFormat object.

Return Value

Variant

Remarks

Numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

If you want to nudge a shadow horizontally or vertically from its current position without having to specify an absolute position, use the IncrementOffsetX method or the IncrementOffsetY method.

Example

This example sets the horizontal and vertical offsets of the shadow for shape three on page one of the active publication. The shadow is offset 5 points to the right of the shape and 3 points above it. If the shape doesn't already have a shadow, this example adds one to it.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes(3).Shadow
 .Visible = True
 .OffsetX = 5
 .OffsetY = -3
End With


Options.AutoSelectWord Property (Publisher)

 Copy code hover
[image]

Options.AutoSelectWord Property (Publisher)
Send feedback

True for Microsoft Publisher to automatically select the entire word when selecting text. Read/write Boolean.

Syntax

expression .AutoSelectWord

expression A variable that represents an Options object.

Return Value

Boolean

Example

This example sets Publisher global options, including enabling automatically selecting an entire word when selecting text.

Copy code Copy code
Sub SetGlobalOptions()
 With Options
 .AutoFormatWord = True
 .AutoKeyboardSwitching = True
 .AutoSelectWord = True
 .DragAndDropText = True
 .UseCatalogAtStartup = False
 .UseHelpfulMousePointers = False
 End With
End Sub


TextEffectFormat.NormalizedHeight Property (Publisher)

 Copy code hover
[image]

TextEffectFormat.NormalizedHeight Property (Publisher)
Send feedback

Specifies whether all characters (both uppercase and lowercase) in the specified WordArt are the same height. Read/write.

Syntax

expression .NormalizedHeight

expression A variable that represents a TextEffectFormat object.

Return Value

MsoTriState

Remarks

The NormalizedHeight property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | Characters in the specified WordArt object are not all the same height.
msoTrue | Characters in the specified WordArt object are all the same height.

Example

This example creates a new WordArt shape on the first page of the active publication and then sets each character in the shape to be the same height.

VBA Copy code Copy code
Sub SetNormalHeight()
 With ActiveDocument.Pages(1).Shapes.AddTextEffect _
 (PresetTextEffect:=msoTextEffect10, _
 text:="Test WordArt Shape", FontName:="Snap ITC", _
 FontSize:=30, FontBold:=msoFalse, FontItalic:=msoFalse, _
 Left:=36, Top:=36).TextEffect
 .NormalizedHeight = msoTrue
 End With
End Sub


TabStops.Application Property (Publisher)

 Copy code hover
[image]

TabStops.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a TabStops object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Document.Pages Property (Publisher)

 Copy code hover
[image]

Document.Pages Property (Publisher)
Send feedback

Returns a Pages collection representing all the pages in the specified publication.

Syntax

expression .Pages

expression A variable that represents a Document object.

Example

The following example returns the Pages collection of the active publication and reports how many pages there are.

VBA Copy code Copy code
Dim pgsTemp As Pages

Set pgsTemp = ActiveDocument.Pages

With pgsTemp
 MsgBox "There are " & .Count _
 & " page(s) in the active publication."
End With


Publisher 2013 developer reference copyright notice

 Copy code hover
[image]

Publisher 2013 developer reference copyright notice
Send feedback

This document is provided "as-is". Information and views expressed in this document, including URL and other Internet Web site references, may change without notice. You bear the risk of using it.

Some examples depicted herein are provided for illustration only and are fictitious. No real association or connection is intended or should be inferred.

This document does not provide you with any legal rights to any intellectual property in any Microsoft product. You may copy and use this document for your internal, reference purposes.

© 2013 Microsoft Corporation. All rights reserved.

Microsoft, Access, ActiveX, ClearType, Excel, FrontPage, InfoPath, IntelliSense, JScript, MSDN, MS-DOS, MSN, OneNote, Outlook, PowerPoint, SharePoint, Silverlight, SmartArt, SQL Server, Visio, Visual Basic, Visual C#, Visual C++, Visual Studio, Win32, Windows, Windows PowerShell, Windows Server, and Windows Vista are trademarks of the Microsoft group of companies.

All other trademarks are property of their respective owners.


Table Methods (Publisher)

 Copy code hover
[image]

Table Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
ApplyAutoFormat | Applies automatic built-in table formatting to a specified table.


Document.UpdateOLEObjects Method (Publisher)

 Copy code hover
[image]

Document.UpdateOLEObjects Method (Publisher)
Send feedback

Updates linked and embedded OLE objects.

Syntax

expression .UpdateOLEObjects

expression A variable that represents a Document object.

Example

This example updates all OLE objects in the active publication.

Copy code Copy code
Sub SearchAndUpdateOLEObjects()
 ActiveDocument.UpdateOLEObjects
End Sub


MailMergeDataSource Methods (Publisher)

 Copy code hover
[image]

MailMergeDataSource Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
ApplyFilter | Applies a filter to a mail merge data source to remove (or filter out) specified records containing (or not containing) specific data.
Close | Closes the specified mail merge data source, cancels the mail merge, and converts all mail merge data fields to plain text.
EditRecord | Changes one of the data fields in one of the records in the master data source (the combined mail-merge recipient list).
FindRecord | Searches the contents of the specified mail merge data source for text in a particular field. Returns a Boolean indicating whether the search text is found; True if the search text is found.
OpenRecipientsDialog | Displays the Recipients dialog box for a mail merge publication.
SetAllErrorFlags | Marks all records in a mail merge data source as containing invalid data in an address field.
SetAllIncludedFlags | True to include all data source records in a mail merge.
SetSortOrder | Sets the sort order for mail merge data.


WebNavigationBarHyperlinks Members (Publisher)

 Copy code hover
[image]

WebNavigationBarHyperlinks Members (Publisher)
Send feedback

The WebNavigationBarHyperlinks represents a collection of all the Hyperlink objects of the specified WebNavigationBarSet object.

Methods

Name | Description
Add | Adds a new Hyperlink object to the specified WebNavigationBarHyperlinks collection and returns the new Hyperlink object. .
Item | Returns an individual object in a specified collection.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Printer.PaperHeight Property (Publisher)

 Copy code hover
[image]

Printer.PaperHeight Property (Publisher)
Send feedback

Gets or sets the height of the printed page in points. Read/write.

Version Information

Version Added: Publisher 2007

Syntax

expression .PaperHeight

expression A variable that represents a Printer object.

Return Value

Long


Cell.BorderDiagonal Property (Publisher)

 Copy code hover
[image]

Cell.BorderDiagonal Property (Publisher)
Send feedback

Returns a CellBorder object that represents the diagonal border for a specified table cell.

Syntax

expression .BorderDiagonal

expression A variable that represents a Cell object.

Return Value

CellBorder

Example

This example diagonally splits every other cell in the specified table and adds a diagonal border. This example assumes the first shape on page two is a table and not another type of shape.

Copy code Copy code
Sub FillCellsByRow()
 Dim shpTable As Shape
 Dim rowTable As Row
 Dim celTable As Cell
 Dim intCell As Integer

 intCell = 1

 Set shpTable = ActiveDocument.Pages(2).Shapes(1)
 For Each rowTable In shpTable.Table.Rows
 For Each celTable In rowTable.Cells
 If intCell Mod 2 = 0 Then
 With celTable
 .Diagonal = pbTableCellDiagonalDown
 With .BorderDiagonal
 .Weight = 1
 .Color.RGB = RGB(Red:=0, Green:=0, Blue:=0)
 End With
 End With
 celTable.Fill.ForeColor.RGB = RGB _
 (Red:=180, Green:=180, Blue:=180)
 Else
 celTable.Fill.ForeColor.RGB = RGB _
 (Red:=255, Green:=255, Blue:=255)
 End If
 intCell = intCell + 1
 Next celTable
 Next rowTable

End Sub


ColorFormat Members (Publisher)

 Copy code hover
[image]

ColorFormat Members (Publisher)
Send feedback

Represents the color of a one-color object or the foreground or background color of an object with a gradient or patterned fill. You can set colors to an explicit red-green-blue value by using the RGB property.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
BaseCMYK | Returns the base cyan-magenta-yellow-black (CMYK) color value of the parent ColorFormat object before any tinting or shading is applied to the color. Read-only.
BaseRGB | Returns or sets an MsoRGBType constant that represents the original RGB color format before color-changing properties, such as tinting and shading, are applied. Read/write.
CMYK | Returns a ColorCMYK object that represents CMYK color properties.
Ink | Returns or sets a Long indicating whether the specified color is a spot color, and if so, the spot plate to which it belongs. Valid values are pbInkNone (default; meaning that the color is not a spot color) or a number between 1 and n where n is the number of spot plates. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
RGB | Returns or sets an MsoRGBType that represents the red-green-blue (RGB) value of the specified color. Read/write.
SchemeColor | Specifies the color of the current color scheme. Read/write.
TintAndShade | Returns or sets a Single that represents the lightening or darkening of a specified shape's color. Read/write.
Transparency | Gets or sets the degree of transparency of the color represented by the parent ColorFormat object as a value between 0.0 (opaque) and 1.0 (clear). Read/write.
Type | Returns or sets a PbColorType constant that represents the shape color type. Read-only.


ReaderSpread.Parent Property (Publisher)

 Copy code hover
[image]

ReaderSpread.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a ReaderSpread object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Shape.SaveAsPicture Method (Publisher)

 Copy code hover
[image]

Shape.SaveAsPicture Method (Publisher)
Send feedback

Saves a single shape as a picture file.

Version Information

Version Added: Publisher 2007

Syntax

expression .SaveAsPicture(Filename, pbResolution)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | The path and file name of the new picture file you want to create. The graphics format the picture is saved in is determined by the file name extension (such as .jpg or .gif) you specify.
pbResolution | Optional | PbPictureResolution | The resolution in which you want the picture to be saved. See Remarks for possible values.

Remarks

Possible values for the pbResolution parameter are declared in the PbPictureResolution enumeration in the Microsoft Publisher type library.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the SaveAsPicture method to save the first shape in the shapes collection on the first page of the active publication as a .jpg picture file.

Before running this code, replace filename.jpg with a valid file name and the path to a folder on your computer where you have permission to save files.

VBA Copy code Copy code
Public Sub SaveAsPicture_Example()

 ThisDocument.Pages(1).Shapes(1).SaveAsPicture "filename.jpg"

End Sub


CalloutFormat.Parent Property (Publisher)

 Copy code hover
[image]

CalloutFormat.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a CalloutFormat object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


LayoutGuides.MarginLeft Property (Publisher)

 Copy code hover
[image]

LayoutGuides.MarginLeft Property (Publisher)
Send feedback

Returns or sets a Variant that represents the amount of space (in points) between the text and the left edge of a cell, text frame, or page. Read/write.

Syntax

expression .MarginLeft

expression A variable that represents a LayoutGuides object.

Example

This example sets the margins of the active publication to two inches.

Copy code Copy code
Sub SetPageMargins()

 With ActiveDocument.LayoutGuides
 .MarginTop = Application.InchesToPoints(Value:=2)
 .MarginBottom = Application.InchesToPoints(Value:=2)
 .MarginLeft = Application.InchesToPoints(Value:=2)
 .MarginRight = Application.InchesToPoints(Value:=2)
 End With

End Sub


MasterPages.FindByPageID Method (Publisher)

 Copy code hover
[image]

MasterPages.FindByPageID Method (Publisher)
Send feedback

Returns a Page object that represents the page with the specified page ID number. Each page is automatically assigned a unique ID number when it is created. Use the PageID property to return a page's ID number.

Syntax

expression .FindByPageID(PageID)

expression A variable that represents a MasterPages object.

Parameters

Name | Required/Optional | Data Type | Description
PageID | Required | Long | Specifies the ID number of the page you want to return. Publisher assigns this number when the page is created.

Return Value

Page

Remarks

Unlike the PageIndex property, the PageID property of a Page object won't change when you add pages to or rearrange pages in the publication. Therefore, using the FindByPageID method with the page ID number can be a more reliable way to return a specific Page object from a Pages collection than using the Item method with the page's index number.

Example

This example demonstrates how to retrieve the unique ID number for a Page object and then use this number to return that Page object from the Pages collection and add a new shape to the page.

Copy code Copy code
Sub FindPage()
 Dim lngPageID As Long

 'Get page ID
 lngPageID = ActiveDocument.Pages.Add(Count:=1, After:=1).PageID

 'Use page ID to add a new shape to the page
 ActiveDocument.Pages.FindByPageID(PageID:=lngPageID) _
 .Shapes.AddShape Type:=msoShape5pointStar, _
 Left:=200, Top:=72, Width:=50, Height:=50

End Sub


Plates.Application Property (Publisher)

 Copy code hover
[image]

Plates.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a Plates object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


MailMergeDataSources.Count Property (Publisher)

 Copy code hover
[image]

MailMergeDataSources.Count Property (Publisher)
Send feedback

Returns the number of MailMergeDataSource objects in the MailMergeDataSources collection of the active document. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .Count

expression A variable that represents a MailMergeDataSources collection.

Return Value

Long


MailMergeDataFields Members (Publisher)

 Copy code hover
[image]

MailMergeDataFields Members (Publisher)
Send feedback

A collection of MailMergeDataField objects that represent the data fields in a mail merge or catalog merge data source.

Methods

Name | Description
Item | Returns a MailMergeDataField object from the specified MailMergeDataFields object.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Creator | Returns a Long that represents the application in which the specified object was created. For example, if the object was created in Microsoft Publisher, this property returns the hexadecimal number 4D505542, which represents the string "MSPB." This value can also be represented by the constant.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


WebListBoxItems.Selected Method (Publisher)

 Copy code hover
[image]

WebListBoxItems.Selected Method (Publisher)
Send feedback

Selects or cancels the selection of an item in a Web list box control.

Syntax

expression .Selected(Index, SelectState)

expression A variable that represents a WebListBoxItems object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The number of the Web list box item.
SelectState | Required | Boolean | True to select the list item.

Example

This example verifies that an existing Web list box control allows selecting multiple entries and then selects two items in the list.

Copy code Copy code
Sub SelectListBoxItem()
 With ActiveDocument.Pages(1).Shapes(1) _
 .WebListBox
 If .MultiSelect = msoTrue Then
 With .ListBoxItems
 .Selected Index:=1, SelectState:=True
 .Selected Index:=3, SelectState:=True
 End With
 End If
 End With
End Sub


ShapeRange.TextFrame Property (Publisher)

 Copy code hover
[image]

ShapeRange.TextFrame Property (Publisher)
Send feedback

Returns a TextFrame object that represents the text in a shape and the properties that control the margins and orientation of the text.

Syntax

expression .TextFrame

expression A variable that represents a ShapeRange object.

Example

The following example adds text to the text frame of shape one in the active publication, and then formats the new text. This example assumes there is at least one shape on the first page of the active publication.

Copy code Copy code
Sub AddTextToTextFrame()
 With ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange
 .Text = "My Text"
 With .Font
 .Bold = msoTrue
 .Size = 25
 .Name = "Arial"
 End With
 End With
End Sub


LinkFormat Properties (Publisher)

 Copy code hover
[image]

LinkFormat Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
SourceFullName | Returns a String that represents the path and name of the source file for the specified linked OLE object, picture, or field. Read-only.


Application.WebOptions Property (Publisher)

 Copy code hover
[image]

Application.WebOptions Property (Publisher)
See also Send feedback

Returns a WebOptions object, which represents the properties of Web publications. Read-only.

Syntax

expression .WebOptions

expression A variable that represents a Application object.

Return Value

WebOptions

Example

The following example specifies that Web publications should not always be saved in default encoding, and that the encoding should be Unicode (UTF-8).

VBA Copy code Copy code
With Application.WebOptions
 .AlwaysSaveInDefaultEncoding = False
 .Encoding = msoEncodingUTF8
End With

See also

Concepts

Application Object

Other resources

Application Object Members


PictureFormat.HasTransparencyColor Property (Publisher)

 Copy code hover
[image]

PictureFormat.HasTransparencyColor Property (Publisher)
Send feedback

Returns a Boolean that indicates whether a transparency color has been applied to the specified picture. Read-only.

Syntax

expression .HasTransparencyColor

expression A variable that represents a PictureFormat object.

Return Value

Boolean

Example

The following example returns a list of the pictures with transparency colors in the active publication.

Copy code Copy code
Sub ListPicturesWithTransColors()
Dim pgLoop As Page
Dim shpLoop As Shape

 For Each pgLoop In ActiveDocument.Pages
 For Each shpLoop In pgLoop.Shapes

 If shpLoop.Type = pbPicture Or shpLoop.Type = pbLinkedPicture Then

 With shpLoop.PictureFormat
 If .IsEmpty = msoFalse Then
 If .HasTransparencyColor = True Then
 Debug.Print .Filename
 End If
 End If
 End With

 End If

 Next shpLoop
 Next pgLoop

End Sub


ColorCMYK.Yellow Property (Publisher)

 Copy code hover
[image]

ColorCMYK.Yellow Property (Publisher)
Send feedback

Sets or returns a Long that represents the yellow component of a CMYK color. Value can be any number between 0 and 255. Read/write.

Syntax

expression .Yellow

expression A variable that represents a ColorCMYK object.

Return Value

Long

Example

This example creates two new shapes and then sets the CMYK fill color for one shape and sets the CMYK values of the second shape to the same CMYK values.

VBA Copy code Copy code
Sub ReturnAndSetCMYK()
 Dim lngCyan As Long
 Dim lngMagenta As Long
 Dim lngYellow As Long
 Dim lngBlack As Long
 Dim shpHeart As Shape
 Dim shpStar As Shape

 Set shpHeart = ActiveDocument.Pages(1).Shapes.AddShape _
 (Type:=msoShapeHeart, Left:=100, _
 Top:=100, Width:=100, Height:=100)
 Set shpStar = ActiveDocument.Pages(1).Shapes.AddShape _
 (Type:=msoShape5pointStar, Left:=200, _
 Top:=100, Width:=150, Height:=150)

 With shpHeart.Fill.ForeColor.CMYK
 .SetCMYK 10, 80, 200, 30
 lngCyan = .Cyan
 lngMagenta = .Magenta
 lngYellow = .Yellow
 lngBlack = .Black
 End With

 'Sets new shape to current shapes CMYK colors
 shpStar.Fill.ForeColor.CMYK.SetCMYK _
 Cyan:=lngCyan, Magenta:=lngMagenta, _
 Yellow:=lngYellow, Black:=lngBlack
End Sub


Shape.Ungroup Method (Publisher)

 Copy code hover
[image]

Shape.Ungroup Method (Publisher)
Send feedback

Ungroups the specified group of shapes or any groups of shapes in the specified shape range. If the specified shape is a picture or OLE object, Microsoft Publisher will break it apart and convert it to an ungrouped set of shapes. (For example, an embedded Microsoft Office Excel spreadsheet is converted into lines and text boxes.) Returns the ungrouped shapes as a single ShapeRange object.

Syntax

expression .Ungroup

expression A variable that represents a Shape object.

Return Value

ShapeRange

Remarks

Using this method on an inline shape or a shape that isn't a group, picture, or OLE object generates an error. Also, an error occurs if the picture is a bitmap, JPEG, GIF, or PNG (Portable Network Graphics) file.

Because a group of shapes is treated as a single object, grouping and ungrouping shapes changes the number of items in the Shapes collection and changes the index numbers of items that come after the affected items in the collection. Also, newly ungrouped shapes are added to the Shapes collection on the current page (or pages) or scratch area. As a result, they may shift from one collection to another.

Example

This example ungroups any grouped shapes on the first page of the active publication.

VBA Copy code Copy code
Dim shpLoop As Shape

For Each shpLoop In ActiveDocument.Pages(1).Shapes
 If shpLoop.Type = pbGroup Then shpLoop.Ungroup
Next shpLoop


Cell.Parent Property (Publisher)

 Copy code hover
[image]

Cell.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a Cell object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


ColorsInUse.Count Property (Publisher)

 Copy code hover
[image]

ColorsInUse.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a ColorsInUse object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


WizardProperty Properties (Publisher)

 Copy code hover
[image]

WizardProperty Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
CurrentValueId | Returns or sets a Long indicating the value of a setting in the specified publication design or Design Gallery object's wizard. Read/write.
Enabled | True if a wizard property is enabled. Read-only Boolean.
ID | Returns a Long that represents the type of a shape, range of shapes, or property, type, or value of a wizard. Read-only.
Name | Returns a String value indicating the name of the specified object. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Values | Returns a WizardValues collection representing all the valid values for a wizard property.


WebNavigationBarSet.HorizontalButtonCount Property (Publisher)

 Copy code hover
[image]

WebNavigationBarSet.HorizontalButtonCount Property (Publisher)
Send feedback

Sets or returns a Long representing the number of buttons in each row of buttons for a Web navigation bar set. Read/write. Long.

Syntax

expression .HorizontalButtonCount

expression A variable that represents a WebNavigationBarSet object.

Return Value

Long

Remarks

Returns "Access denied" if IsHorizontal = False for the specified WebNavigationBarSet object. Use the ChangeOrientation method to set the orientation of the Web navigation bar set to horizontal first before setting the HorizontalButtonCount property.

Example

The following example returns the first Web navigation bar set from the active document, changes the orientation to horizontal if necessary, sets the HorizontalButtonCount property to 3, and then sets the HorizontalAlignment property to pbnbAlignLeft.

Copy code Copy code
With ActiveDocument.WebNavigationBarSets(1)
 If .IsHorizontal = False Then
 .ChangeOrientation pbNavBarOrientHorizontal
 End If
 .HorizontalButtonCount = 3
 .HorizontalAlignment = pbnbAlignRight
End With


PhoneticGuide.Clear Method (Publisher)

 Copy code hover
[image]

PhoneticGuide.Clear Method (Publisher)
Send feedback

Removes the phonetic information from Japanese text.

Syntax

expression .Clear

expression A variable that represents a PhoneticGuide object.


Columns.Count Property (Publisher)

 Copy code hover
[image]

Columns.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a Columns object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


ShapeRange.Left Property (Publisher)

 Copy code hover
[image]

ShapeRange.Left Property (Publisher)
Send feedback

Returns a Variant indicating the distance from the left edge of the page to the leftmost edge of all the shapes in the specified shape range. Numeric values are in points; all other values are in any measurement supported by Publisher (for example, "2.5 in"). Read-only.

Syntax

expression .Left

expression A variable that represents a ShapeRange object.


Row.Delete Method (Publisher)

 Copy code hover
[image]

Row.Delete Method (Publisher)
Send feedback

Deletes the specified object.

Syntax

expression .Delete

expression A variable that represents a Row object.

Remarks

A run-time error occurs if the specified object does not exist.


Application.Language Property (Publisher)

 Copy code hover
[image]

Application.Language Property (Publisher)
See also Send feedback

Returns a Long that represents the language selected for the Microsoft Publisher user interface. Read-only.

Syntax

expression .Language

expression A variable that represents a Application object.

Return Value

Long

Remarks

The LanguageID property value can be one of the MsoLanguageID constants declared in the Microsoft Office type library.

Example

This example displays a message stating whether the language selected for the Publisher user interface is U.S. English.

VBA Copy code Copy code
Sub LangSetting()
 If Application.Language = msoLanguageIDEnglishUS Then
 MsgBox "The user interface language is U.S. English."
 Else
 MsgBox "The user interface language is not U.S. English."
 End If
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


MasterPages Object (Publisher)

 Copy code hover
[image]

MasterPages Object (Publisher)
Send feedback

Represents the page master for a publication after which all pages in the publication will be designed. The MasterPages object is a collection of Page objects.

Example

Use the MasterPages property to return a MasterPages object. The following example adds two ruler guides to the master page so that each page in the active publication is divided into quarters.

Copy code Copy code
Sub ChangeMasterPage()
 Dim intWidth As Integer
 Dim intHeight As Integer

 With ActiveDocument
 intWidth = .PageSetup.PageWidth
 intWidth = intWidth / 2
 intHeight = .PageSetup.PageHeight
 intHeight = intHeight / 2
 With .MasterPages(1).RulerGuides
 .Add Position:=intWidth, _
 Type:=pbRulerGuideTypeVertical
 .Add Position:=intHeight, _
 Type:=pbRulerGuideTypeHorizontal
 End With
 End With
End Sub

Use the Shapes property to work with AutoShapes and text boxes on the master page. This example adds a small red heart shape to the upper left corner of the master page that will appear on each page in the active publication.

Copy code Copy code
Sub AddShapeToMasterPage()
 ActiveDocument.MasterPages(1).Shapes.AddShape(Type:=msoShapeHeart, _
 Left:=36, Top:=36, Width:=36, Height:=36).Fill _
 .ForeColor.RGB = RGB(Red:=255, Green:=0, Blue:=0)
End Sub


CellRange Properties (Publisher)

 Copy code hover
[image]

CellRange Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Column | Returns a Long that represents the table column containing the specified cell. Read-only.
Count | Returns a Long that represents the number of items in the specified collection.
Height | Returns a Long that represent the height (in cells) of a table, range of cells, or page. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Row | Returns a Long that represents the row number containing the specified cell. Read-only.
Width | Returns a Long that represent the width (in cells) of a table, range of cells, or page. Read-only.


MailMergeFilters Object (Publisher)

 Copy code hover
[image]

MailMergeFilters Object (Publisher)
Send feedback

Represents all the filters to apply to the data source attached to the mail merge or catalog merge publication. The MailMergeFilters object is composed of MailMergeFilterCriterion objects.

Example

Use the Add method of the MailMergeFilters object to add a new filter criterion to the query. This example adds a new line to the query string and then applies the combined filter to the data source. This example assumes that a data source is attached to the active publication.

Copy code Copy code
Sub FilterDataSource()
 With ActiveDocument.MailMerge.DataSource
 .Filters.Add Column:="Region", _
 Comparison:=msoFilterComparisonIsBlank, _
 Conjunction:=msoFilterConjunctionAnd
 .ApplyFilter
 End With
End Sub

Use the Item method to access an individual filter criterion. This example loops through all the filter criterion and if it finds one with a value of "Region", changes it to remove from the mail merge all records that are not equal to "WA". This example assumes that a data source is attached to the active publication.

Copy code Copy code
Sub SetQueryCriterion()
 Dim intItem As Integer
 With ActiveDocument.MailMerge.DataSource.Filters
 For intItem = 1 To .Count
 With .Item(intItem)
 If .Column = "Region" Then
 .Comparison = msoFilterComparisonNotEqual
 .CompareTo = "WA"
 If .Conjunction = "Or" Then .Conjunction = "And"
 End If
 End With
 Next
 End With
End Sub


PageSize.Parent Property (Publisher)

 Copy code hover
[image]

PageSize.Parent Property (Publisher)
Send feedback

Returns the parent of the PageSize object. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .Parent

expression A variable that represents a PageSize object.

Return Value

Object


PrintableRect Members (Publisher)

 Copy code hover
[image]

PrintableRect Members (Publisher)
Send feedback

Represents the sheet area within which the specified printer will print. The printable rectangle is determined by the printer based on the sheet size specified. The printable rectangle of the printer sheet should not be confused with the area within the margins of the publication page; it may be larger or smaller than the publication page.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Height | Returns a Single that represents the height, in points, of the printable rectangle. Read-only.
Left | Returns a Single indicating the distance (in points) from the left edge of the printer sheet to the left edge of the printable rectangle. Read-only.
Parent | Returns an object that represents the parent object of the specified object. Read-only.
Top | Returns the a Single that represents the distance (in points) from the top edge of the printer sheet to the top edge of the printable rectangle. Read-only.
Width | Returns a Single that represents the printable rectangle. Read-only.


TextRange.Length Property (Publisher)

 Copy code hover
[image]

TextRange.Length Property (Publisher)
Send feedback

Returns a Long value indicating the length of the specified text range, in characters. Read-only.

Syntax

expression .Length

expression A variable that represents a TextRange object.

Example

This example sets the font size of a text frame on page two to 48 points if the text frame contains more than five characters, or it sets the font size to 72 points if the text frame has five or fewer characters.

VBA Copy code Copy code
With ActiveDocument.Pages(2).Shapes(1) _
 .TextFrame.TextRange
 If .Length > 5 Then
 .Font.Size = 48
 Else
 .Font.Size = 72
 End If
End With


PageBackground.Delete Method (Publisher)

 Copy code hover
[image]

PageBackground.Delete Method (Publisher)
Send feedback

Deletes the specified object.

Syntax

expression .Delete

expression A variable that represents a PageBackground object.

Remarks

A run-time error occurs if the specified object does not exist.


Font.Bold Property (Publisher)

 Copy code hover
[image]

Font.Bold Property (Publisher)
Send feedback

Returns or sets an MsoTriState constant that represents the state of the Bold property on the characters in a text range. Read/write.

Syntax

expression .Bold

expression A variable that represents a Font object.

Return Value

MsoTriState

Remarks

The Bold property value can be one of the following MsoTriState constants declared in the Microsoft Office type library.

Constant | Description
msoFalse | None of the characters in the range are formatted as bold.
msoTriStateMixed | Return value indicating that the range contains some text formatted as bold and some text not formatted as bold.
msoTriStateToggle | Set value that switches between msoTrue and msoFalse.
msoTrue | All characters in the range are formatted as bold.

Example

This example tests all the text in the second story of the active publication and, if it contains both bold text and not bold text, it sets all the text to bold. If the text is all bold or all not bold, a message is displayed informing the user there is no mixed bolding. For this code to execute properly, there must be two or more stories with text in the active publication.

Copy code Copy code
Sub BoldStory()

 Dim stf As Publisher.Font

 Set stf = Application.ActiveDocument.Stories(2).TextRange.Font
 With stf
 If .Bold = msoTriStateMixed Then
 .Bold = msoTrue
 Else
 MsgBox "Mixed bolding is not in this story."
 End If
 End With

End Sub


WebNavigationBarSet Object (Publisher)

 Copy code hover
[image]

WebNavigationBarSet Object (Publisher)
Send feedback

Represents a Web navigation bar set for the current document. The WebNavigationBarSet object is a member of the WebNavigationBarSets collection, which includes all of the Web navigation bar sets in the current document.

Example

Use WebNavigationBarSet.AddToEveryPage(Left, Top, [Width]), where Left is the position of the left edge of the shape, Top is the position of the top edge of the shape, and Width is the width of the shape representing the Web navigation bar set, to add the specified Web navigation bar to every page of a document. The following example adds the first Web navigation bar set to every page that has the AddHyperlinkToWebNavbar property set to True when adding the page or the Page.WebPageOptions.IncludePageOnNewWebNavigationBars property set to True.

Copy code Copy code
Dim objWebNavBarSet as WebNavigationBarSet
Set objWebNavBarSet = ActiveDocument.WebNavigationBarSets(1)
objWebNavBarSet.AddToEveryPage Left:=50, Top:=10, Width:=500

Use WebNavigationBarSet.DeleteSetAndInstances to remove the Web navigation bar set and every instance of it from the document. The following example deletes all instances of each WebNavigationBarSet object in the WebNavigationBarSets collection.

Copy code Copy code
Dim objWebNavBarSet As WebNavigationBarSet
For Each objWebNavBarSet In ActiveDocument.WebNavigationBarSets
 objWebNavBarSet.DeleteSetAndInstances
Next objWebNavBarSet

There are three properties that concern horizontally oriented Web navigation bars. Use WebNavigationBarSet.IsHorizontal to determine the orientation of the navigation bar set. The ChangeOrientation method is used to set the orientation of the Web navigation bar set. If the orientation is set to horizontal, HorizontalAlignment and HorizontalButtonCount properties can then be set. The following example adds the first navigation bar in the WebNavigationBarSets collection of the active document to each page that has the AddHyperlinkToWebNavbar property set to True or the Page.WebPageOptions.IncludePageOnNewWebNavigationBars property set to True, and then sets the button style to small. A test is performed to determine whether the navigation bar set is horizontal or not. If it is not, the ChangeOrientation method is called and the orientation is set to horizontal. After the navigation bar is oriented horizontally, the horizontal button count is set to 3 and the horizontal alignment of the buttons is set to left.

Copy code Copy code
Dim objWebNav As WebNavigationBarSet
Set objWebNav = ActiveDocument.WebNavigationBarSets(1)
With objWebNav
 .AddToEveryPage Left:=10, Top:=10
 If .IsHorizontal = False Then
 .ChangeOrientation pbNavBarOrientHorizontal
 End If
 .HorizontalButtonCount = 3
 .HorizontalAlignment = pbnbAlignLeft
End With


MailMerge.SuppressBlankLines Property (Publisher)

 Copy code hover
[image]

MailMerge.SuppressBlankLines Property (Publisher)
Send feedback

True to suppress blank lines when mail merge fields in a mail merge main document are empty. Read/write Boolean.

Syntax

expression .SuppressBlankLines

expression A variable that represents a MailMerge object.

Return Value

Boolean

Example

This example suppresses blank lines in the active publication when mail merge fields are blank. This example assumes that a mail merge data source is attached to the active publication.

VBA Copy code Copy code
Sub SuppressBlankLines()
 ActiveDocument.MailMerge.SuppressBlankLines = True
End Sub


TextFrame.ColumnSpacing Property (Publisher)

 Copy code hover
[image]

TextFrame.ColumnSpacing Property (Publisher)
Send feedback

Returns or sets a Variant that represents the amount of space between text columns. Read/write.

Syntax

expression .ColumnSpacing

expression A variable that represents a TextFrame object.

Return Value

Variant

Remarks

Spacing measures from the end of the text to the end of the column and again from the beginning of the column to the beginning of the text. Thus, if you enter a ColumnSpacing amount of 0.5 inch, the total spacing between columns is one inch: 0.5 inch measuring from the end of the text to the end of the column in one column, plus 0.5 inch measuring from the beginning of the column to the beginning of the text in a neighboring column.

Example

This example formats the first text box in the active publication with three columns and a total of 0.5 inch spacing between columns.

Copy code Copy code
Sub SetColumnsAndSpacing()
 With ActiveDocument.Pages(1).Shapes(1).TextFrame
 .Columns = 3
 .ColumnSpacing = InchesToPoints(0.25)
 End With
End Sub


pbCanvasArrangementType Enumeration (Publisher)

 Copy code hover
[image]

pbCanvasArrangementType Enumeration (Publisher)
Send feedback

Constants passed to and returned by the Shapes.CanvasArrangementType property, specifying the arrangement type of the canvas.

Version Information

Version Added: Publisher 2010

Name | Value | Description
pbCanvasArrangementTypeColsCanvas | 1 | Canvas arranged into columns.
pbCanvasArrangementTypeOneCanvas | 0 | Canvas arranged as a single unit.
pbCanvasArrangementTypeRowsCanvas | 2 | Canvas arranged into rows.


Shape.RemoveFromCatalogMergeArea Method (Publisher)

 Copy code hover
[image]

Shape.RemoveFromCatalogMergeArea Method (Publisher)
Send feedback

Removes a shape from the specified page's catalog merge area. Removed shapes are not deleted, but instead remain in place on the page containing the catalog merge area.

Syntax

expression .RemoveFromCatalogMergeArea

expression A variable that represents a Shape object.

Return Value

Nothing

Remarks

Use the AddToCatalogMergeArea method of the Shape or ShapeRange objects to add shapes to a catalog merge area.

Use the RemoveCatalogMergeArea method of the Shape object to remove the catalog merge area from a publication page, but leave the shapes it contains.

Example

The following example tests whether any page of the specified publication contains a catalog merge area. If any page does, all the shapes are removed from the catalog merge area and deleted, and the catalog merge area is then removed from the publication.

Copy code Copy code
Sub DeleteCatalogMergeAreaAndAllShapesWithin()
 Dim pgPage As Page
 Dim mmLoop As Shape
 Dim intCount As Integer
 Dim strName As String

 For Each pgPage In ThisDocument.Pages
 For Each mmLoop In pgPage.Shapes

 If mmLoop.Type = pbCatalogMergeArea Then
 With mmLoop.CatalogMergeItems
 For intCount = .Count To 1 Step -1
 strName = mmLoop.CatalogMergeItems.Item(intCount).Name
 .Item(intCount).RemoveFromCatalogMergeArea
 pgPage.Shapes(strName).Delete
 Next
 End With
 mmLoop.RemoveCatalogMergeArea
 End If

 Next mmLoop
 Next pgPage

 End Sub


Application.DocumentOpen Event (Publisher)

 Copy code hover
[image]

Application.DocumentOpen Event (Publisher)
See also Send feedback

Occurs when opening a document.

Syntax

expression .DocumentOpen(Doc)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The document that's being opened.

Example

This example displays a message with the document's name when opening a document.

Copy code Copy code
Private Sub appPub_DocumentOpen(ByVal Doc As Document)
 MsgBox "Please wait. " & Doc.Name & " is opening."
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Printer.PaperSource Property (Publisher)

 Copy code hover
[image]

Printer.PaperSource Property (Publisher)
Send feedback

Returns the paper source setting found on the Publication and Paper Settings tab in the Print Setup dialog box in the Microsoft Publisher user interface (File menu). Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .PaperSource

expression A variable that represents a Printer object.

Return Value

String


Document.MailEnvelope Property (Publisher)

 Copy code hover
[image]

Document.MailEnvelope Property (Publisher)
Send feedback

Returns an MsoEnvelope object that represents an e-mail header for a publication.

Syntax

expression .MailEnvelope

expression A variable that represents a Document object.

Return Value

MsoEnvelope

Remarks

The MailEnvelope property is only accessible if the EnvelopeVisible property has been set to True.

Example

This example sets the comments for the e-mail header of the active publication. This example assumes that the EnvelopeVisible property has been set to True.

Copy code Copy code
Sub HeaderComments()
 ActiveDocument.MailEnvelope.Introduction = _
 "Please review this publication and let me know " & _
 "what you think. I need your input by Friday." & _
 " Thanks."
End Sub


Pages.Add Method (Publisher)

 Copy code hover
[image]

Pages.Add Method (Publisher)
Send feedback

Adds a new Page object to the specified Pages object and returns the new Page object.

Syntax

expression .Add(Count, After, DuplicateObjectsOnPage, AddHyperlinkToWebNavBar)

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Count | Required | Long | The number of new pages to add.
After | Required | Long | The page index of the page after which to add the new pages. A zero for this argument adds new pages at the beginning of the publication.
DuplicateObjectsOnPage | Optional | Long | The page index of the page from which objects should be copied to the new pages. If this argument is omitted, the new pages will be blank. The default is -1: do not duplicate pages.
AddHyperlinkToWebNavBar | Optional | Boolean | Specifies whether links to the new pages will be added to the automatic navigation bars of existing pages. If True, links to the new pages will be added to the automatic navigation bars of existing pages only. If False, links to the new pages will not be added to the automatic navigation bars of existing pages or new pages added in the future. Default is False.

Return Value

Page

Example

The following example adds four new pages after the first page in the publication and copies all the objects from the first page to the new pages.

VBA Copy code Copy code
Dim pgNew As Page

Set pgNew = ActiveDocument.Pages _
 .Add(Count:=4, After:=1, DuplicateObjectsOnPage:=1)

The following example demonstrates adding two new pages to the publication and setting the AddHyperlinkToWebNavBar parameter to True for these two pages. This specifies that links to these two new pages be added to the automatic navigation bars of existing pages and those added in the future.

Another page is then added to the publication, and the AddHyperlinkToWebNavBar is omitted. This means that the IncludePageOnNewWebNavigationBars property is False for the newly added page, and links to this page will not be included in the automatic navigation bars of existing pages.

VBA Copy code Copy code
Dim thePage As page
Dim thePage2 As page

Set thePage = ActiveDocument.Pages.Add(Count:=2, _
 After:=4, AddHyperlinkToWebNavBar:=True)

Set thePage2 = ActiveDocument.Pages.Add(Count:=1, After:=6)


ReflectionFormat.Transparency Property (Publisher)

 Copy code hover
[image]

ReflectionFormat.Transparency Property (Publisher)
See also Send feedback

Returns or sets the degree of transparency for the reflection effect as a value between 0.0 (opaque) and 1.0 (clear). Read/write Single.

Version Information

Version Added: Publisher 2013

Syntax

expression .Transparency

expression A variable that represents a ReflectionFormat object.

Return value

Single

See also

Other resources

ReflectionFormat Object Members
ReflectionFormat Object


PictureFormat.OriginalWidth Property (Publisher)

 Copy code hover
[image]

PictureFormat.OriginalWidth Property (Publisher)
Send feedback

Returns a Variant that represents, in points, the width of the specified linked picture or OLE object. Read-only.

Syntax

expression .OriginalWidth

expression A variable that represents an PictureFormat object.

Return Value

Variant

Remarks

This property applies only to linked pictures. Returns "Permission Denied" for shapes representing embedded or pasted pictures.

To determine whether a shape represents a linked picture, use either the Type property of the Shape object, or the IsLinked property of the PictureFormat object.

Example

The following example tests each picture in the active publication, and returns selected image properties for pictures that are linked.

VBA Copy code Copy code
Dim pgLoop As Page
Dim shpLoop As Shape

For Each pgLoop In ActiveDocument.Pages
 For Each shpLoop In pgLoop.Shapes
 If shpLoop.Type = pbLinkedPicture Then

 With shpLoop.PictureFormat

 Debug.Print "File Name: " & .Filename
 Debug.Print "Vertical Scaling: " & .VerticalScale & "%"
 Debug.Print "Original Image Width: " & .OriginalWidth & " points"
 Debug.Print "Width in publication: " & .Width & " points"

 End With
 End If
 Next shpLoop
Next pgLoop


WizardValues.Parent Property (Publisher)

 Copy code hover
[image]

WizardValues.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a WizardValues object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Shape.Rotation Property (Publisher)

 Copy code hover
[image]

Shape.Rotation Property (Publisher)
Send feedback

Returns or sets a Single that represents the number of degrees the specified shape is rotated around the z-axis. A positive value indicates clockwise rotation; a negative value indicates counterclockwise rotation. Read/write.

Syntax

expression .Rotation

expression A variable that represents a Shape object.

Remarks

To set the rotation of a three-dimensional shape around the x-axis or the y-axis, use the RotationX property or the RotationY property of the ThreeDFormat object.

Example

This example matches the rotation of all shapes on the first page of the active publication to the rotation of the first shape. This example assumes there are at least two shapes on the first page of the active publication.

Copy code Copy code
Sub SetShapeRotation()
 Dim sngRotation As Single
 Dim intCount As Integer
 With ActiveDocument.Pages(1).Shapes
 sngRotation = .Item(1).Rotation
 For intCount = 1 To .Count
 .Item(intCount).Rotation = sngRotation
 Next intCount
 End With
End Sub


LineFormat Members (Publisher)

 Copy code hover
[image]

LineFormat Members (Publisher)
Send feedback

Represents line and arrowhead formatting. For a line, the LineFormat object contains formatting information for the line itself; for a shape with a border, this object contains formatting information for the shape's border.

Methods

Name | Description
PresetGradient |

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
BackColor | Returns or sets a ColorFormat object representing the background color for the specified fill or patterned line. .
BeginArrowheadLength | Returns or sets an MsoArrowheadLength constant indicating the length of the arrowhead at the beginning of the specified line. Read/write.
BeginArrowheadStyle | Returns or sets an MsoArrowheadStyle constant indicating the style of the arrowhead at the beginning of the specified line. Read/write.
BeginArrowheadWidth | Returns or sets an MsoArrowheadWidth constant indicating the width of the arrowhead at the beginning of the specified line. Read/write.
CapStyle | Specifies the style of line endings, as well as the format of dashed lines. Read-write.
DashStyle | Returns or sets an MsoLineDashStyle constant indicating the dash style for the specified line. Read/write.
EndArrowheadLength | Returns or sets an MsoArrowheadLength constant indicating the length of the arrowhead at the end of the specified line. Read/write.
EndArrowheadStyle | Returns or sets an MsoArrowheadStyle constant indicating the style of the arrowhead at the end of the specified line. Read/write.
EndArrowheadWidth | Returns or sets an MsoArrowheadWidth constant indicating the width of the arrowhead at the end of the specified line. Read/write.
ForeColor | Returns or sets a ColorFormat object representing the foreground color for the fill, line, or shadow. Read/write.
GradientAngle | Returns or sets the angle of the gradient fill for the specified fill format. Read/write.
GradientColorType | Returns the gradient color type for the specified line. Read-only.
GradientStyle | Returns the gradient style for the specified line. Read-only.
GradientVariant | Returns the gradient variant for the specified line as an integer value, usually from 1 to 4. Read-only.
InsetPen | Returns or sets an MsoTriState constant indicating whether a specified shape's lines are drawn inside its boundaries. Read/write.
JoinStyle | Returns of sets the join style for the specified line. Read-write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Pattern | Returns or sets an MsoPatternType constant that represents the pattern applied to the specified fill or line.
PresetGradientType | Returns the preset gradient type for the specified line. Read-only.
Style | Returns or sets an MsoLineStyle constant that represents the style of line to apply to a shape or border. Read/write.
Transparency | Returns or sets the degree of transparency of lines. Read/write Single.
Type | Returns the line fill-format type. Read-only.
Visible | Returns or sets an MsoTriState constant indicating whether the specified object or the formatting applied to the specified object is visible. Read/write.
Weight | Returns or sets a Variant indicating the thickness of the specified line or cell border.


MailMergeDataFields.Creator Property (Publisher)

 Copy code hover
[image]

MailMergeDataFields.Creator Property (Publisher)
Send feedback

Returns a Long that represents the application in which the specified object was created. For example, if the object was created in Microsoft Publisher, this property returns the hexadecimal number 4D505542, which represents the string "MSPB." This value can also be represented by the constant.

Syntax

expression .Creator

expression A variable that represents a MailMergeDataFields object.


Application.MailMergeWizardStateChange Event (Publisher)

 Copy code hover
[image]

Application.MailMergeWizardStateChange Event (Publisher)
See also Send feedback

Occurs when a user changes from a specified step to a specified step in the Mail Merge Wizard.

Syntax

expression .MailMergeWizardStateChange(Doc, FromState)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The mail merge main document.
FromState | Required | Integer | The Mail Merge Wizard step from which a user is moving.

Remarks

To access the Application object events, declare an Application object variable in the General Declarations section of a code module. Then set the variable equal to the Application object for which you want to access events.

Example

This example displays a message when a users moves from step three of the Mail Merge Wizard to step four. Based on the user's answer to the message, the user will either continue on to step four or return to step three.

Copy code Copy code
Private Sub MailMergeApp_MailMergeWizardStateChange(ByVal Doc As Document, _
 ByVal FromState As Long)

 Select Case FromState
 Case 1
 MsgBox "Now you will build your publication merge " & _
 "by adding fields to your publication."
 Case 2
 MsgBox "Now you will see your publication " & _
 "merged with the records in the data source."
 Case 3
 MsgBox "Now you will complete the mail merge process."
 End Select

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Options.SaveAutoRecoverInfoInterval Property (Publisher)

 Copy code hover
[image]

Options.SaveAutoRecoverInfoInterval Property (Publisher)
Send feedback

Returns or sets a Long that represents the time interval in minutes for automatically saving a publication for recovery if the application is unexpectedly shut down. Read/write.

Syntax

expression .SaveAutoRecoverInfoInterval

expression A variable that represents a Options object.

Return Value

Long

Example

This example enables the global auto recovery option and sets the save interval to every five minutes.

VBA Copy code Copy code
Sub SetAutoRecoverInfo()
 With Options
 .SaveAutoRecoverInfo = True
 .SaveAutoRecoverInfoInterval = 5
 End With
End Sub


Window.Height Property (Publisher)

 Copy code hover
[image]

Window.Height Property (Publisher)
Send feedback

Returns or sets a Long that represents the height (in points) of the window. Read/write.

Syntax

expression .Height

expression A variable that represents a Window object.

Remarks

The valid range for the Height property depends on the size of the application workspace and the position of the object within the workspace. For centered objects on non-banner page sizes, the Height property may be 0.0 to 50.0 inches. For centered objects on banner page sizes, the Height property may be 0.0 to 241.0 inches.

Example

This example sets the height and width of the active window if the window is neither maximized nor minimized.

VBA Copy code Copy code
Sub SetWindowHeight()
 With ActiveWindow
 If .WindowState <> pbWindowStateNormal Then
 .WindowState = pbWindowStateNormal
 .Height = InchesToPoints(5)
 .Width = InchesToPoints(5)
 End If
 End With
End Sub


Shape.Line Property (Publisher)

 Copy code hover
[image]

Shape.Line Property (Publisher)
Send feedback

Returns a LineFormat object that contains line formatting properties for the specified shape. (For a line, the LineFormat object represents the line itself; for a shape with a border, the LineFormat object represents the border.).

Syntax

expression .Line

expression A variable that represents a Shape object.

Example

This example adds a blue dashed line to the active publication.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes _
 .AddLine(BeginX:=10, BeginY:=10, _
 EndX:=250, EndY:=250).Line
 .DashStyle = msoLineDashDotDot
 .ForeColor.RGB = RGB(50, 0, 128)
End With

This example adds a cross to the first page and then sets its border to be 8 points thick and red.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes _
 .AddShape(Type:=msoShapeCross, _
 Left:=10, Top:=10, Width:=50, Height:=70).Line
 .Weight = 8
 .ForeColor.RGB = RGB(255, 0, 0)
End With


ShapeRange.PictureFormat Property (Publisher)

 Copy code hover
[image]

ShapeRange.PictureFormat Property (Publisher)
Send feedback

Returns a PictureFormat object that contains picture formatting properties for the specified object. Applies to Shape or ShapeRange objects that represent pictures or OLE objects. Read-only.

Syntax

expression .PictureFormat

expression A variable that represents a ShapeRange object.

Example

This example sets the brightness and contrast for all pictures on the first page of the active publication.

Copy code Copy code
Sub FixPictureContrastBrightness()
 Dim shp As Shape
 For Each shp In ActiveDocument.Pages(1).Shapes
 If shp.Type = pbPicture Then
 With shp.PictureFormat
 .Brightness = 0.6
 .Contrast = 0.6
 End With
 End If
 Next shp
End Sub


ColorsInUse Properties (Publisher)

 Copy code hover
[image]

ColorsInUse Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Item | Returns an individual object from a specified collection. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


ShapeRange.Parent Property (Publisher)

 Copy code hover
[image]

ShapeRange.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a ShapeRange object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


PageBackground Members (Publisher)

 Copy code hover
[image]

PageBackground Members (Publisher)
Send feedback

Represents the background of a page.

Methods

Name | Description
Create | Creates a new PageBackground object for the specified Page object.
Delete | Deletes the specified object.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Exists | True if the specified PageBackground object exists. Read/write Boolean.
Fill | Returns a FillFormat object representing the fill for the specified shape or table cell.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


FillFormat.TextureVerticalScale Property (Publisher)

 Copy code hover
[image]

FillFormat.TextureVerticalScale Property (Publisher)
See also Send feedback

Returns or sets a Single that specifies the vertical scaling factor for the texture fill. Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .TextureVerticalScale

expression A variable that represents a FillFormat object.

Property value

FLOAT

Remarks

The setting of the TextureVerticalScale property corresponds to the setting of the Scale Y box on the Fill tab of the Format Shape dialog box in the Publisher 2013 user interface. (Under Drawing Tools, on the Format tab, click Shape Fill, point to Texture, and then click More Textures.)

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


ThreeDFormat.Application Property (Publisher)

 Copy code hover
[image]

ThreeDFormat.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a ThreeDFormat object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


LineFormat.EndArrowheadLength Property (Publisher)

 Copy code hover
[image]

LineFormat.EndArrowheadLength Property (Publisher)
Send feedback

Returns or sets an MsoArrowheadLength constant indicating the length of the arrowhead at the end of the specified line. Read/write.

Syntax

expression .EndArrowheadLength

expression A variable that represents an LineFormat object.

Return Value

MsoArrowheadLength

Remarks

Use the BeginArrowheadLength property to return or set the length of the arrowhead at the beginning of the line.

The EndArrowheadLenght property value can be one of the MsoArrowheadLength constants declared in the Microsoft Office type library.

Example

This example adds a line to the active publication. There is a short, narrow oval on the line's starting point and a long, wide triangle on its endpoint.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes _
 .AddLine(BeginX:=100, BeginY:=100, _
 EndX:=200, EndY:=300).Line
 .BeginArrowheadLength = msoArrowheadShort
 .BeginArrowheadStyle = msoArrowheadOval
 .BeginArrowheadWidth = msoArrowheadNarrow
 .EndArrowheadLength = msoArrowheadLong
 .EndArrowheadStyle = msoArrowheadTriangle
 .EndArrowheadWidth = msoArrowheadWide
End With


BorderArtFormat.RevertToDefaultWeight Method (Publisher)

 Copy code hover
[image]

BorderArtFormat.RevertToDefaultWeight Method (Publisher)
See also Send feedback

Sets the BorderArt on the specified shape back to its default thickness.

Syntax

expression .RevertToDefaultWeight

expression A variable that represents a BorderArtFormat object.

Remarks

The RevertToDefaultWeight method has the same effect as the Always apply at default size control on the BorderArt dialog box.

Use the Weight property of the BorderArtFormat object to set the specified BorderArt to a thickness other than the default.

Example

The following example tests for the existence of BorderArt on each shape for each page of the active document. If BorderArt exists, its weight is set to the default thickness and original color.

Copy code Copy code
Sub RestoreBorderArtDefaults()

Dim anyPage As Page
Dim anyShape As Shape

For Each anyPage in ActiveDocument.Pages
 For Each anyShape in anyPage.Shapes
 With anyShape.BorderArt
 If .Exists = True Then
 .RevertToDefaultWeight
 .RevertToOriginalColor
 End If
 End With
 Next anyShape
Next anyPage
End Sub

See also

Concepts

BorderArtFormat Object

Other resources

BorderArtFormat Object Members


BorderArtFormat.Delete Method (Publisher)

 Copy code hover
[image]

BorderArtFormat.Delete Method (Publisher)
See also Send feedback

Deletes the specified object.

Syntax

expression .Delete

expression A variable that represents a BorderArtFormat object.

Remarks

A run-time error occurs if the specified object does not exist.

Example

The following example tests for the existence of BorderArt on each shape for each page of the active publication. If BorderArt exists, it is deleted.

VBA Copy code Copy code
Sub DeleteBorderArt()

Dim anyPage As Page
Dim anyShape As Shape

For Each anyPage in ActiveDocument.Pages
 For Each anyShape in anyPage.Shapes
 With anyShape.BorderArt
 If .Exists = True Then
 .Delete
 End If
 End With
 Next anyShape
 Next anyPage
End Sub

See also

Concepts

BorderArtFormat Object

Other resources

BorderArtFormat Object Members


ConnectorFormat.EndConnectedShape Property (Publisher)

 Copy code hover
[image]

ConnectorFormat.EndConnectedShape Property (Publisher)
Send feedback

Returns a Shape object that represents the shape to which the end of the specified connector is attached.

Syntax

expression .EndConnectedShape

expression A variable that represents an ConnectorFormat object.

Return Value

Shape

Remarks

If the end of the specified connector isn't attached to a shape, an error occurs.

Use the BeginConnectedShape property to return the shape attached to the beginning of a connector.

Example

This example assumes that the first page in the active publication already contains two shapes attached by a connector named Conn1To2. The code adds a rectangle and a connector to the first page. The end of the new connector will be attached to the same connection site as the end of the connector named Conn1To2, and the beginning of the new connector will be attached to connection site one on the new rectangle.

Copy code Copy code
Dim shpNew As Shape
Dim intSite As Integer
Dim shpOld As Shape

With ActiveDocument.Pages(1).Shapes

 ' Add new rectangle.
 Set shpNew = .AddShape(Type:=msoShapeRectangle, _
 Left:=450, Top:=190, Width:=200, Height:=100)

 ' Add new connector.
 .AddConnector(Type:=msoConnectorCurve, _
 BeginX:=0, BeginY:=0, EndX:=10, EndY:=10) _
 .Name = "Conn1To3"

 ' Get connection site number of old shape, and set
 ' reference to old shape.
 With .Item("Conn1To2").ConnectorFormat
 intSite = .EndConnectionSite
 Set shpOld = .EndConnectedShape
 End With

 ' Connect new connector to old shape and new rectangle.
 With .Item("Conn1To3").ConnectorFormat
 .EndConnect ConnectedShape:=shpOld, _
 ConnectionSite:=intSite
 .BeginConnect ConnectedShape:=shpNew, _
 ConnectionSite:=1
 End With
End With


Shape.SetShapesDefaultProperties Method (Publisher)

 Copy code hover
[image]

Shape.SetShapesDefaultProperties Method (Publisher)
Send feedback

Applies the formatting for the specified shape or shape range to the default shape. Shapes created after this method has been used will have this formatting applied to them by default.

Syntax

expression .SetShapesDefaultProperties

expression A variable that represents a Shape object.

Remarks

The SetShapesDefaultProperties method stores two different sets of default properties, one for a Shape object's AutoShapeType Property, and another for a TextFrame object. In other words, if this method is called on an AutoShape, the default formatting of that object will apply only to new AutoShapes, and will not apply to new text boxes. If this method is called on a text box, the default formatting of that object will apply only to new text boxes, and will not apply to new AutoShapes.

Example

This example adds a rectangle to the active publication, formats the rectangle's fill, applies the rectangle's formatting to the default shape, and then adds another smaller rectangle to the document. The second rectangle has the same fill as the first one.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes

 With .AddShape(Type:=msoShapeRectangle, _
 Left:=5, Top:=5, Width:=80, Height:=60)
 With .Fill
 .ForeColor.RGB = RGB(0, 0, 255)
 .BackColor.RGB = RGB(0, 204, 255)
 .Patterned Pattern:=msoPatternHorizontalBrick
 End With
 .SetShapesDefaultProperties
 End With

 .AddShape Type:=msoShapeRectangle, _
 Left:=90, Top:=90, Width:=40, Height:=30

End With


InlineShapes Properties (Publisher)

 Copy code hover
[image]

InlineShapes Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Range | Returns a ShapeRange collection that represents the same set of inline shapes as the InlineShapes collection whose method was called. This allows for miscellaneous formatting of the contained shapes. Read-only.


WebPageOptions Methods (Publisher)

 Copy code hover
[image]

WebPageOptions Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
SetBackgroundSoundRepeat | Specifies whether the background sound attached to a Web page should be played infinitely after the page is loaded in a Web browser, and if it should not, optionally specifies the number of times the background sound should be played.


Columns Object (Publisher)

 Copy code hover
[image]

Columns Object (Publisher)
Send feedback

A collection of Column objects that represent the columns in a table.

Example

Use the Columns property of the Table object to return the Columns collection. The following example displays the number of Column objects in the Columns collection for the first table in the active document.

Copy code Copy code
Sub CountColumns()
 MsgBox "The number of columns in the table is " & _
 ActiveDocument.Pages(2).Shapes(1).Table.Columns.Count
End Sub

This example enters a bold number into each cell in the specified table. This example assumes the specified shape is a table and not another type of shape.

Copy code Copy code
Sub CountCellsByColumn()
 Dim shpTable As Shape
 Dim colTable As Column
 Dim celTable As Cell
 Dim intCount As Integer

 intCount = 1

 Set shpTable = ActiveDocument.Pages(2).Shapes(1)
 For Each colTable In shpTable.Table.Columns
 For Each celTable In colTable.Cells
 With celTable.Text
 .Text = intCount
 .ParagraphFormat.Alignment = _
 pbParagraphAlignmentCenter
 .Font.Bold = msoTrue
 intCount = intCount + 1
 End With
 Next celTable
 Next colTable

End Sub

Use Columns(index), where index is the index number, to return a single Column object. The index number represents the position of the column in the Columns collection (counting from left to right). The following example selects the third column in the specified table.

Copy code Copy code
Sub SelectColumns()
 ActiveDocument.Pages(2).Shapes(1).Table.Columns(3).Cells.Select
End Sub

Use the Add method to add a column to a table. This example adds a column to the specified table on the second page of the active publication, and then adjusts the width, merges the cells, and sets the fill color. This example assumes the first shape is a table and not another type of shape.

Copy code Copy code
Sub NewColumn()
 Dim colNew As Column

 Set colNew = ActiveDocument.Pages(2).Shapes(1).Table.Columns _
 .Add(BeforeColumn:=3)
 With colNew
 .Width = 2
 .Cells.Merge
 .Cells(1).Fill.ForeColor.RGB = RGB(Red:=202, Green:=202, Blue:=202)
 End With
End Sub


Cell.Fill Property (Publisher)

 Copy code hover
[image]

Cell.Fill Property (Publisher)
Send feedback

Returns a FillFormat object representing the fill for the specified shape or table cell.

Syntax

expression .Fill

expression A variable that represents a Cell object.

Example

This example creates a new AutoShape object and fills the shape with green.

VBA Copy code Copy code
Sub NewShapeItem()

 Dim shpHeart As Shape

 Set shpHeart = ThisDocument.MasterPages.Item(1).Shapes _
 .AddShape(Type:=msoShapeHeart, Left:=40, Top:=80, _
 Width:=50, Height:=50)
 shpHeart.Fill.ForeColor.RGB = RGB(Red:=0, Green:=255, Blue:=0)

End Sub


EmailMergeEnvelope.Subject Property (Publisher)

 Copy code hover
[image]

EmailMergeEnvelope.Subject Property (Publisher)
Send feedback

Gets or sets the subject line of the merged e-mail message. Read/write.

Version Information

Version Added: Publisher 2007

Syntax

expression .Subject

expression A variable that represents an EmailMergeEnvelope object.

Return Value

String


ThreeDFormat Methods (Publisher)

 Copy code hover
[image]

ThreeDFormat Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
IncrementRotationX | Changes the rotation of the specified shape around the x-axis (horizontal) by the specified number of degrees.
IncrementRotationY | Changes the rotation of the specified shape around the y-axis (vertical) by the specified number of degrees.
ResetRotation | Resets the extrusion rotation around the x-axis (horizontal) and the y-axis (vertical) to 0 (zero) so that the front of the extrusion faces forward.
SetExtrusionDirection | Sets the direction that the extrusion's sweep path takes away from the extruded shape.
SetThreeDFormat | Sets the preset extrusion format. Each preset extrusion format contains a set of preset values for the 3-D properties of the extrusion.


ThreeDFormat.BevelTopType Property (Publisher)

 Copy code hover
[image]

ThreeDFormat.BevelTopType Property (Publisher)
See also Send feedback

Returns or sets an MsoPresetCamera constant that represents the bevel type for the top bevel. Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .BevelTopType

expression A variable that represents a ThreeDFormat object.

Return value

MSOBEVELTYPE

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


PictureFormat Properties (Publisher)

 Copy code hover
[image]

PictureFormat Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Brightness | Returns or sets a Single indicating the brightness of the specified picture or OLE object. The value for this property must be a number from 0.0 (dimmest) to 1.0 (brightest). Read/write.
ColorModel | Returns a PbColorModel constant that represents the color model of the picture. Read-only.
ColorsInPalette | Returns a Long that represents the number of colors in the picture's palette. Read-only.
ColorType | Returns or sets an MsoPictureColorType constant indicating the type of color transformation applied to the specified picture or OLE object. Read/write.
Contrast | Returns or sets a Single indicating the contrast for the specified picture or OLE object. The value for this property must be a number from 0.0 (the least contrast) to 1.0 (the greatest contrast). Read/write.
CropBottom | Returns or sets a Variant indicating the amount by which the bottom edge of a picture or OLE object is cropped. Read/write.
CropLeft | Returns or sets a Variant indicating the amount by which the left edge of a picture or OLE object is cropped. Read/write.
CropRight | Returns or sets a Variant indicating the amount by which the right edge of a picture or OLE object is cropped. Read/write.
CropTop | Returns or sets a Variant indicating the amount by which the top edge of a picture or OLE object is cropped. Read/write.
EffectiveResolution | Returns a Long that represents, in dots per inch (dpi), the effective resolution of the picture. Read-only.
Filename | Returns a String that represents the file name of the specified picture or OLE object. Read-only.
FileSize | Returns a Long that represents, in bytes, the size of the picture or OLE object as it appears in the specified publication. Read-only.
HasAlphaChannel | Returns an MsoTriState constant indicating whether the specified picture contains an alpha channel. Read-only.
HasTransparencyColor | Returns a Boolean that indicates whether a transparency color has been applied to the specified picture. Read-only.
Height | Returns a Variant that represents the height, in points, of the specified picture or OLE object. Read-only.
HorizontalPictureLocking | Returns or sets a PbHorizontalPictureLocking constant indicating where newly inserted pictures appear in relation to the specified frame. Read/write.
HorizontalScale | Returns a Long that represents the scaling of the picture along its horizontal axis. The scaling is expressed as a percentage (for example, 200 equals 200 percent scaling). Read-only.
ImageFormat | Returns a PbImageFormat constant that represents the image format of a picture as determined by Microsoft Windows Graphics Device Interface (GDI+). Read-only.
IsEmpty | Returns a MsoTriState constant that represents whether the specified shape is an empty picture frame. Read-only.
IsGreyScale | Returns a MsoTriState constant that indicates whether the picture is a greyscale image. Read-only.
IsLinked | Returns a MsoTriState constant indicating whether the specified picture is a linked picture or OLE object. Read-only.
IsRecolored | Returns True if the image represented by the parent PictureFormat object has been recolored, either in the user interface or by using the PictureFormat.Recolor method. Read-only.
IsTrueColor | Returns an MsoTriState constant indicating whether the specified picture or OLE object contains color data of 24 bits per channel or greater. Read-only.
LeaveBlackAsBlack | Returns True if, when you recolor the image represented by the parent PictureFormat object, the black parts of the original image should remain black. Read-only.
LinkedFileStatus | Returns a PbLinkedFileStatus constant that indicates the status of the file linked to the specified picture. Read-only.
OriginalColorsInPalette | Returns a Long that represents the number of colors in the specified linked picture's palette. Read-only.
OriginalFileSize | Returns a Long representing the size, in bytes, of the linked picture or OLE object. Read-only.
OriginalHasAlphaChannel | Returns an MsoTriState constant depending on whether the original, linked picture contains an alpha channel. Read-only.
OriginalHeight | Returns a Variant representing the height, in points, of the specified linked picture or OLE object. Read-only.
OriginalIsTrueColor | Returns an MsoTriState constant indicating whether the specified linked picture or OLE object contains color data of 24 bits per channel or greater. Read-only.
OriginalResolution | Returns a Long that represents, in dots per inch (dpi), the resolution at which the linked picture was originally scanned. Read-only.
OriginalWidth | Returns a Variant that represents, in points, the width of the specified linked picture or OLE object. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
RecoloredPictureColor | Returns the color that has been applied to the image represented by the parent PictureFormat object. Read-only.
TransparencyColor | Returns or sets an MsoRGBType constant that represents the transparency color. Read/write.
TransparentBackground | Indicates whether the parts of the specified picture that are defined as the transparent color appear transparent. Read/write.
VerticalPictureLocking | Returns or sets a PbVerticalPictureLocking constant indicating where newly inserted pictures appear in relation to the specified frame. Read/write.
VerticalScale | Returns a Long that represents the scaling of the picture along its vertical axis. The scaling is expressed as a percentage (for example, 200 equals 200 percent scaling). Read-only.
Width | Returns a Variant that represents the width, in points, of the specified picture. Read-only.


MailMergeDataField.IsMapped Property (Publisher)

 Copy code hover
[image]

MailMergeDataField.IsMapped Property (Publisher)
Send feedback

Indicates if the parent MailMergeDataField object is mapped to a recipient field in the master data source (combined mail-merge recipient list). Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .IsMapped

expression A variable that represents a MailMergeDataField object.

Return Value

Boolean

Remarks

The parent MailMergeDataField object must represent a field (column) in a connected data source that is not the master data source (the combination of all connected data sources). The IsMapped property is not available for data fields in the data source represented by the DataSource property of the MailMerge object of the active Document object (ThisDocument.MailMerge.DataSource).


BuildingBlock Methods (Publisher)

 Copy code hover
[image]

BuildingBlock Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified BuildingBlock object from the BuildingBlocks collection returned by the Document.AvailableBuildingBlocks property for the current document.


Tag.Application Property (Publisher)

 Copy code hover
[image]

Tag.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a Tag object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


TextEffectFormat Members (Publisher)

 Copy code hover
[image]

TextEffectFormat Members (Publisher)
Send feedback

Contains properties and methods that apply to WordArt objects.

Methods

Name | Description
ToggleVerticalText | Switches the text flow in the specified WordArt from horizontal to vertical, or vice versa.

Properties

Name | Description
Alignment | Returns or sets a MsoTextEffectAlignment constant that represents the alignment for the specified text effect. Read/write.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
FontBold | Sets or returns an MsoTriState constant that represents whether the font for a dropped capital letter or WordArt text effect is bold. Read/write.
FontItalic | Sets or returns an MsoTriState constant that represents whether the font for a dropped capital letter or WordArt text effect is italic. Read/write.
FontName | Sets or returns a String that represents the name of the font applied to a dropped capital letter or WordArt text effect. Read/write.
FontSize | Returns or sets a Variant that represents the font size for the specified WordArt, in points. Read/write.
KernedPairs | Sets or returns an MsoTriState constant that indicates whether character pairs in a WordArt object have been kerned. Read/write.
NormalizedHeight | Specifies whether all characters (both uppercase and lowercase) in the specified WordArt are the same height. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
PresetShape | Returns or sets an MsoPresetTextEffectShape constant that represents the shape of the specified WordArt. Read/write.
PresetTextEffect | Returns or sets an MsoPresetTextEffect constant that represents the style of the specified WordArt. The values for this property correspond to the formats in the WordArt Gallery dialog box, numbered from left to right, top to bottom. Read/write.
PresetWordArt | A pbPresetWordArt constant that indicates the type of preset WordArt associated with the specified object. Read/write.
RotatedChars | msoTrue if characters in the specified WordArt are rotated 90 degrees relative to the WordArt's bounding shape. msoFalse if characters in the specified WordArt retain their original orientation relative to the bounding shape. Read/write.
Text | Returns or sets a String that represents the text in a text range or WordArt shape. Read/write.
Tracking | Returns or sets a Variant indicating the tracking value used to display space between the characters in the specified text range. Read/write.


ParagraphFormat.ListType Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.ListType Property (Publisher)
Send feedback

Returns a PbListType constant from the specified ParagraphFormat object. Read-only.

Syntax

expression .ListType

expression A variable that represents a ParagraphFormat object.

Return Value

pbListType

Remarks

This property is read-only. To set the ListType property of a ParagraphFormat object, use the SetListType method.

The ListType property value can be one of the PbListType constants declared in the Microsoft Publisher type library.

Example

This example tests to see if the list type is a numbered list, specifically pbListTypeArabic. If the ListType property is set to pbListTypeArabic, the ListNumberSeparator property value is set to pbListSeparatorParenthesis.

VBA Copy code Copy code
Dim objParaForm As ParagraphFormat

Set objParaForm = ActiveDocument.Pages(1).Shapes(1) _
.TextFrame.TextRange.ParagraphFormat

With objParaForm
 If .ListType = pbListTypeArabic Then
 .ListNumberSeparator = pbListSeparatorParenthesis
 End If
End With


Shapes.AddCatalogMergeArea Method (Publisher)

 Copy code hover
[image]

Shapes.AddCatalogMergeArea Method (Publisher)
Send feedback

Adds a Shape object that represents the specified publication's catalog merge area.

Syntax

expression .AddCatalogMergeArea

expression A variable that represents a Shapes object.

Return Value

Shape

Remarks

Only one catalog merge area can be added to a publication page. Typically, a publication will only have one catalog merge area.

Although you can add one catalog merge area per publication page, you can only connect to a single data source for a publication. What data is merged is determined by the catalog merge area on the active page, and the data fields it contains.

Note Note

You must add a catalog merge area to the publication page before you connect to a data source.

Use the AddToCatalogMergeArea method of the Shape or ShapeRange objects to add shapes to a catalog merge area.

Use the Insert method of the MailMergeDataFields collection to add a picture data field to a publication's catalog merge area.

Use the InsertMailMergeField method of the TextRange object to add a text data field to a text box in the publication's catalog merge area.

Use the RemoveCatalogMergeArea method of the Shape object to remove a catalog merge area from a publication.

This method corresponds to selecting a catalog merge in Step 1: Select a merge type of the Mail and Catalog Merge Wizard.

Example

The following example adds a catalog merge area to the first page of the specified publication.

Copy code Copy code
ThisDocument.Pages(1).Shapes.AddCatalogMergeArea


Shape.RerouteConnections Method (Publisher)

 Copy code hover
[image]

Shape.RerouteConnections Method (Publisher)
Send feedback

Reroutes connectors so that they take the shortest possible path between the shapes they connect. To do this, the RerouteConnections method may detach the ends of a connector and reattach them to different connecting sites on the connected shapes.

Syntax

expression .RerouteConnections

expression A variable that represents a Shape object.

Remarks

This method reroutes all connectors attached to the specified shape; if the specified shape is a connector, it is rerouted.

Example

This example adds two rectangles to the first page in the active publication and connects them with a curved connector. Note that the RerouteConnections method overrides the values you supply for the ConnectionSite arguments used with the BeginConnect and EndConnect methods.

Copy code Copy code
Dim shpRect1 As Shape
Dim shpRect2 As Shape

With ActiveDocument.Pages(1).Shapes

 ' Add two new rectangles.
 Set shpRect1 = .AddShape(Type:=msoShapeRectangle, _
 Left:=100, Top:=50, Width:=200, Height:=100)
 Set shpRect2 = .AddShape(Type:=msoShapeRectangle, _
 Left:=300, Top:=300, Width:=200, Height:=100)

 ' Add a new curved connector.
 With .AddConnector(Type:=msoConnectorCurve, _
 BeginX:=0, BeginY:=0, EndX:=100, EndY:=100) _
 .ConnectorFormat

 ' Connect the new connector to the two rectangles.
 .BeginConnect ConnectedShape:=shpRect1, ConnectionSite:=1
 .EndConnect ConnectedShape:=shpRect2, ConnectionSite:=1

 ' Reroute the connector to create the shortest path.
 .Parent.RerouteConnections
 End With

End With


PhoneticGuide Methods (Publisher)

 Copy code hover
[image]

PhoneticGuide Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Clear | Removes the phonetic information from Japanese text.


Hyperlink.SetPageRelative Method (Publisher)

 Copy code hover
[image]

Hyperlink.SetPageRelative Method (Publisher)
Send feedback

Sets the target type for the specified hyperlink.

Syntax

expression .SetPageRelative(RelativePage)

expression A variable that represents a Hyperlink object.

Parameters

Name | Required/Optional | Data Type | Description
RelativePage | Required | PbHlinkTargetType | The target type of the hyperlink.

Remarks

The RelativePage parameter can be one of the following PbHlinkTargetType constants declared in the Microsoft Publisher type library.

pbHlinkTargetTypeEmail

pbHlinkTargetTypeFirstPage

pbHlinkTargetTypeLastPage

pbHlinkTargetTypeNextPage

pbHlinkTargetTypeNone

pbHlinkTargetTypePageID

pbHlinkTargetTypePreviousPage

pbHlinkTargetTypeURL

Example

The following example adds four new hyperlinks to shape one on page one of the active publication and sets their targets accordingly.

VBA Copy code Copy code
Sub SetHyperlinkRelativeTarget()
 Dim hypNew As Hyperlink
 Dim txtRng As TextRange

 ActiveDocument.Pages(1).Shapes _
 .AddTextbox Orientation:=pbTextOrientationHorizontal, _
 Left:=10, Top:=10, Width:=200, Height:=200

 Set txtRng = ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange

 txtRng.Text = "First Page" & vbCrLf

 Set txtRng = ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange
 Set hypNew = ActiveDocument.Pages(1).Shapes(1).TextFrame _
 .TextRange.Hyperlinks.Add(Text:=txtRng, _
 Address:="http://www.tailspintoys.com/")

 'Change hyperlink to be a Page-relative link
 hypNew.SetPageRelative RelativePage:=pbHlinkTargetTypeFirstPage

 txtRng.Collapse pbCollapseEnd
 txtRng.Text = "Previous Page" & vbCrLf

 Set hypNew = ActiveDocument.Pages(1).Shapes(1).TextFrame _
 .TextRange.Hyperlinks.Add(Text:=txtRng, _
 Address:="http://www.tailspintoys.com/")

 hypNew.SetPageRelative RelativePage:=pbHlinkTargetTypePreviousPage

 txtRng.Collapse pbCollapseEnd
 txtRng.Text = "Next Page" & vbCrLf
 Set hypNew = ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.Hyperlinks.Add(Text:=txtRng, _
 Address:="http://www.tailspintoys.com/")
 hypNew.SetPageRelative RelativePage:=pbHlinkTargetTypeNextPage

 txtRng.Collapse pbCollapseEnd
 txtRng.Text = "Last Page" & vbCrLf
 Set hypNew = ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.Hyperlinks.Add(Text:=txtRng, _
 Address:="http://www.tailspintoys.com/")
 hypNew.SetPageRelative RelativePage:=pbHlinkTargetTypeLastPage

End Sub


TextStyle.Delete Method (Publisher)

 Copy code hover
[image]

TextStyle.Delete Method (Publisher)
Send feedback

Deletes the specified object.

Syntax

expression .Delete

expression A variable that represents a TextStyle object.

Remarks

A run-time error occurs if the specified object does not exist.


BuildingBlock.Keywords Property (Publisher)

 Copy code hover
[image]

BuildingBlock.Keywords Property (Publisher)
Send feedback

A string that represents the search keywords associated with the building block. Read/write.

Syntax

expression .Keywords

expression A variable that represents a BuildingBlock object.


Document.Redo Method (Publisher)

 Copy code hover
[image]

Document.Redo Method (Publisher)
Send feedback

Redoes the last action or a specified number of actions. Corresponds to the list of items that appears when you click the arrow beside the Redo button on the Standard toolbar. Calling this method reverses the Undo Method method.

Syntax

expression .Redo(Count)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Count | Optional | Long | Specifies the number of actions to be redone. Default is 1, meaning that if omitted, only the last action will be redone.

Return Value

Nothing

Remarks

If called when there are no actions on the redo stack, or when Count is greater than the number of actions that currently reside on the stack, the Redo method will redo as many actions as possible and ignore the rest.

The maximum number of actions that can be redone in one call to Redo is 20.

Example

The following example uses the Redo method to redo a subset of the actions that were undone using the Undo method.

Part 1 creates a rectangle that contains a text frame on the fourth page of the active publication. Various font properties are set, and text is added to the text frame. In this case, the text "This font is Courier" is set to 12 point bold Courier font.

Part 2 tests whether the text in the text frame is Verdana font. If not, then the Undo method is used to undo the last four actions on the undo stack. The Redo method is then used to redo the the first two of the last four actions that were just undone. In this case, the third action (setting the font size) and the fourth action (setting the font to bold) are redone. The font name is then changed to Verdana, and the text is modified.

Copy code Copy code
Dim thePage As page
Dim theShape As Shape
Dim theDoc As Publisher.Document

Set theDoc = ActiveDocument
Set thePage = theDoc.Pages(4)

' Part 1
With theDoc
 With thePage
 ' Setting the shape creates the first action
 Set theShape = .Shapes.AddShape(msoShapeRectangle, _
 75, 75, 190, 30)
 ' Setting the text range creates the second action
 With theShape.TextFrame.TextRange
 ' Setting the font size creates the third action
 .Font.Size = 12
 ' Setting the font to bold creates the fourth action
 .Font.Bold = msoTrue
 ' Setting the font name creates the fifth action
 .Font.Name = "Courier"
 ' Setting the text creates the sixth action
 .Text = "This font is Courier."
 End With
 End With

 ' Part 2
 If Not thePage.Shapes(1).TextFrame.TextRange.Font.Name = "Verdana" Then
 .Undo (4)
 With thePage
 With theShape.TextFrame.TextRange
 ' Redo redoes the first two of the four actions that were just undone
 theDoc.Redo (2)
 .Font.Name = "Verdana"
 .Text = "This font is Verdana."
 End With
 End With
 End If
End With


Fields.AddHorizontalInVertical Method (Publisher)

 Copy code hover
[image]

Fields.AddHorizontalInVertical Method (Publisher)
Send feedback

Inserts horizontal text into a stream of vertical text and returns the new horizontal text as a Field object.

Syntax

expression .AddHorizontalInVertical(Range, Text)

expression A variable that represents a Fields object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | TextRange | The text range at which to insert the horizontal text.
Text | Required | String | The text to be horizontally inserted.

Return Value

Field

Example

This example horizontally inserts the text "horizontal test" after the existing vertical text in shape one on page one of the active publication.

Copy code Copy code
Dim rngTemp As TextRange
Dim fldTemp As Field

With ActiveDocument.Pages(1).Shapes(1)
 Set rngTemp = .TextFrame.TextRange.InsertAfter("")

 Set fldTemp = .TextFrame.TextRange.Fields _
 .AddHorizontalInVertical(Range:=rngTemp, Text:="horizontal test")
End With


ColorFormat.Type Property (Publisher)

 Copy code hover
[image]

ColorFormat.Type Property (Publisher)
Send feedback

Returns or sets a PbColorType constant that represents the shape color type. Read-only.

Syntax

expression .Type

expression A variable that represents a ColorFormat object.

Remarks

The Type property value can be one of these PbColorType constants.

pbColorTypeCMYK

pbColorTypeInk

pbColorTypeRGB

pbColorTypeScheme


HeaderFooter.TextRange Property (Publisher)

 Copy code hover
[image]

HeaderFooter.TextRange Property (Publisher)
Send feedback

Returns a TextRange object that represents the text that is attached to a shape and properties and methods for manipulating the text.

Syntax

expression .TextRange

expression A variable that represents a HeaderFooter object.

Example

The following example adds text to the text frame of shape one in the active publication, and then formats the new text. This example assumes there is at least one shape on the first page of the active publication.

Copy code Copy code
Sub AddTextToTextFrame()
 With ActiveDocument.Pages(1).TextFrame.TextRange
 .Text = "My Text"
 With .Font
 .Bold = msoTrue
 .Size = 25
 .Name = "Arial"
 End With
 End With
End Sub

The following example adds a rectangle to the active publication and adds text to it.

Copy code Copy code
Sub AddTextToShape()
 With ActiveDocument.Pages(1).Shapes.AddShape(Type:=msoShapeRectangle, _
 Left:=72, Top:=72, Width:=250, Height:=140)
 .TextFrame.TextRange.Text = "Here is some test text"
 End With
End Sub


PictureFormat.Width Property (Publisher)

 Copy code hover
[image]

PictureFormat.Width Property (Publisher)
Send feedback

Returns a Variant that represents the width, in points, of the specified picture. Read-only.

Syntax

expression .Width

expression A variable that represents a PictureFormat object.


ShadowFormat.Size Property (Publisher)

 Copy code hover
[image]

ShadowFormat.Size Property (Publisher)
See also Send feedback

Returns or sets a Single that represents the width of the shadow. Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .Size

expression A variable that represents a ShadowFormat object.

Return value

Single

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


PrintableRect.Parent Property (Publisher)

 Copy code hover
[image]

PrintableRect.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a PrintableRect object.


Plate.Color Property (Publisher)

 Copy code hover
[image]

Plate.Color Property (Publisher)
Send feedback

Returns a ColorFormat object representing the color information for the specified object.

Syntax

expression .Color

expression A variable that represents a Plate object.

Example

This example tests the font color of the first story in the active document and tells the user if the font color is black or not.

Copy code Copy code
Sub FontColor()

 If Application.ActiveDocument.Stories(1) _
 .TextRange.Font.Color.RGB = RGB(Red:=0, Green:=0, Blue:=0) Then
 MsgBox "Your font color is black"
 Else
 MsgBox "Your font color is not black"
 End If

End Sub


WrapFormat.DistanceLeft Property (Publisher)

 Copy code hover
[image]

WrapFormat.DistanceLeft Property (Publisher)
Send feedback

When the Type property of the WrapFormat object is set to pbWrapTypeSquare, returns or sets a Variant that represents the distance (in points) between the document text and the left edge of the specified shape. Read/write.

Syntax

expression .DistanceLeft

expression A variable that represents a WrapFormat object.

Example

This example adds an oval to the active document and specifies that the document text wrap around the left and right sides of the square that circumscribes the oval. The example sets a 0.1-inch margin between the document text and the top, bottom, left side, and right side of the square.

Copy code Copy code
Sub AddNewShape()
 Dim shpOval As Shape

 Set shpOval = ActiveDocument.Pages(1).Shapes _
 .AddShape(Type:=msoShapeOval, Left:=36, _
 Top:=36, Width:=100, Height:=35)
 With shpOval.TextWrap
 .Type = pbWrapTypeSquare
 .Side = pbWrapSideBoth
 .DistanceAuto = msoFalse
 .DistanceTop = InchesToPoints(0.1)
 .DistanceBottom = InchesToPoints(0.1)
 .DistanceLeft = InchesToPoints(0.1)
 .DistanceRight = InchesToPoints(0.1)
 End With
End Sub


Section.Application Property (Publisher)

 Copy code hover
[image]

Section.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a Section object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


WebCommandButton.EmailSubject Property (Publisher)

 Copy code hover
[image]

WebCommandButton.EmailSubject Property (Publisher)
Send feedback

Sets or returns a String that represents the subject for e-mail messages generated to process Web form data. Read/write.

Syntax

expression .EmailSubject

expression A variable that represents a WebCommandButton object.

Example

This example sets Publisher to process data on the Web form in the current publication by sending an e-mail message with a subject line to a specified e-mail address.

Copy code Copy code
Sub WebFormData()
 With ThisDocument.Pages(1).Shapes(1).WebCommandButton
 .DataRetrievalMethod = pbSubmitDataRetrievalEmail
 .EmailAddress = "someone@example.com"
 .EmailSubject = "Web form data"
 End With
End Sub


Application.BeforePrint Event (Publisher)

 Copy code hover
[image]

Application.BeforePrint Event (Publisher)
See also Send feedback

Occurs before the publication is printed or previewed. .

Version Information

Version Added: Publisher 2007

Syntax

expression .BeforePrint(Doc, Cancel)

expression An expression that returns an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The current publication.
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this parameter to True, the publication is not printed when the procedure finishes running.

Remarks

The BeforePrint event fires only after the document is fully loaded and the onload events have returned. Printing does not occur until the event handler is executed.

For more information about using events with the Application object, see Using Events with the Application Object.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to handle the BeforePrint event. It displays a message notifying the user that the document is about to be printed.

VBA Copy code Copy code
Private Sub pubApplication_BeforePrint(ByVal Doc As Document, Cancel As Boolean )
 MsgBox "Printing of " & Doc.Name & " is about to occur ."
End Sub

For this event to occur, you must place the following line of code in the General Declarations section of your module.

VBA Copy code Copy code
Private WithEvents pubApplication As Application

Then run the following initialization procedure.

VBA Copy code Copy code
Public Sub Initialize_pubApplication()
 Set pubApplication = Publisher.Application
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


ObjectVerbs.Item Method (Publisher)

 Copy code hover
[image]

ObjectVerbs.Item Method (Publisher)
Send feedback

Returns an individual object in a specified collection.

Syntax

expression .Item(Index)

expression A variable that represents an ObjectVerbs object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The number of the object to return.

Return Value

String


LineFormat Methods (Publisher)

 Copy code hover
[image]

LineFormat Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
PresetGradient |


WebNavigationBarHyperlinks Object (Publisher)

 Copy code hover
[image]

WebNavigationBarHyperlinks Object (Publisher)
Send feedback

The WebNavigationBarHyperlinks represents a collection of all the Hyperlink objects of the specified WebNavigationBarSet object.

Example

Use the Links property of the WebNavigationBarSets collection to return a WebNavigationBarHyperlinks object. The following example adds a hyperlink to the first WebNavigationBarSet of the active document.

Copy code Copy code
Dim objWebNavLinks As WebNavigationBarHyperlinks
Set objWebNavLinks = ActiveDocument.WebNavigationBarSets(1).Links
objWebNavLinks.Add Address:="www.microsoft.com", _
 TextToDisplay:="Microsoft"

Use WebNavigationBarHyperlinks.Count to return a Long representing the number of hyperlinks in the WebNavigationBarHyperlinks collection of the specified WebNavigationBarSet object. The following example displays the number of hyperlinks in the first WebNavigationBarSet of the active document.

Copy code Copy code
MsgBox ActiveDocument.WebNavigationBarSets(1).Links.Count

Use WebNavigationBarHyperlinks.Item(index), where index is the index number, to return a specific Hyperlink object from the collection. This example displays the displayed text of the first item in the WebNavigationBarHyperlinks collection of the first WebNavigationBarSet of the active document.

Copy code Copy code
MsgBox ActiveDocument.WebNavigationBarSets(1).Links.Item(1).TextToDisplay


Selection.Type Property (Publisher)

 Copy code hover
[image]

Selection.Type Property (Publisher)
Send feedback

Returns a PbSelectionType constant that represents the selection type. Read-only.

Syntax

expression .Type

expression A variable that represents a Selection object.

Remarks

The Type property value can be one of these PbSelectionType constants.

pbSelectionNone

pbSelectionShape

pbSelectionShapeSubSelection

pbSelectionTableCells

pbSelectionText

Example

This example checks to see if the selection is text and if it is, makes the selected text bold.

VBA Copy code Copy code
Sub IfCellData()
 Dim rowTable As Row
 If Selection.Type = pbSelectionText Then
 Selection.TextRange.Font.Bold = msoTrue
 End If
End Sub


Stories Methods (Publisher)

 Copy code hover
[image]

Stories Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Item | Returns an individual object in a specified collection.


Field.Unlink Method (Publisher)

 Copy code hover
[image]

Field.Unlink Method (Publisher)
Send feedback

Replaces the specified field or Fields collection with with their most recent results.

Syntax

expression .Unlink

expression A variable that represents a Field object.

Remarks

When you unlink a field, its current result is converted to text or a graphic and can no longer be updated automatically.

Example

This example unlinks the first field in shape one on the first page of the active publication.

Copy code Copy code
ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.Fields(1).Unlink


WebNavigationBarSet.Parent Property (Publisher)

 Copy code hover
[image]

WebNavigationBarSet.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a WebNavigationBarSet object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Page.Shapes Property (Publisher)

 Copy code hover
[image]

Page.Shapes Property (Publisher)
Send feedback

Returns a Shapes collection that represents all the Shape objects in the specified publication. This collection can contain drawings, shapes, pictures, OLE objects, ActiveX controls, text objects, and callouts.

Syntax

expression .Shapes

expression A variable that represents a Page object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example adds a rectangle to the first page in the active publication.

Copy code Copy code
Sub AddNewRectangle()
 ActiveDocument.Pages(1).Shapes.AddShape Type:=msoShapeRectangle, _
 Left:=5, Top:=25, Width:=100, Height:=50
End Sub

This example sets the fill texture for all the shapes in the active publication. This example assumes there is at least one shape in the active publication.

Copy code Copy code
Sub SetNewTextureForAllShapes()
 Dim shp As Shape
 For Each shp In ActiveDocument.Pages(1).Shapes
 shp.Fill.PresetTextured PresetTexture:=msoTextureOak
 Next shp
End Sub

This example adds a shadow to the first shape in the active publication. This example assumes there is at least one shape in the active publication.

Copy code Copy code
Sub SetShadowForFirstShape()
 ActiveDocument.Pages(1).Shapes(1).Shadow.Type = msoShadow6
End Sub

This example displays a count of all shapes on the first page of the active publication. This example assumes there is at least one shape in the active publication.

Copy code Copy code
Sub CountShapesOnFirstPage()
 MsgBox "You have " & ActiveDocument.Pages(1) _
 .Shapes.Count & " shapes on the first page."
End Sub


ShapeNode Properties (Publisher)

 Copy code hover
[image]

ShapeNode Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
EditingType | If the specified node is a vertex, this property returns an MsoEditingType constant indicating how changes made to the node affect the two segments connected to the node. If the node is a control point for a curved segment, this property returns the editing type of the adjacent vertex. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Points | Gets the x- and y- coordinates of the shape node. Read-only.
SegmentType | Returns an MsoSegmentType constant that indicates whether the segment associated with the specified node is straight or curved. Read-only.


TextEffectFormat.PresetShape Property (Publisher)

 Copy code hover
[image]

TextEffectFormat.PresetShape Property (Publisher)
Send feedback

Returns or sets an MsoPresetTextEffectShape constant that represents the shape of the specified WordArt. Read/write.

Syntax

expression .PresetShape

expression A variable that represents a TextEffectFormat object.

Return Value

MsoPresetTextEffectShape

Remarks

The PresetShape property value can be one of the MsoPresetTextEffectShape constants declared in the Microsoft Office type library.

Example

This example sets the shape of the first shape on the first page of the active publication to a chevron whose center points down. For this example to work the first shape must be a WordArt shape.

VBA Copy code Copy code
Sub ChangeTextEffect()
 With ActiveDocument.Pages(1).Shapes(1)
 If .Type = msoTextEffect Then
 .TextEffect.PresetShape = msoTextEffectShapeChevronDown
 End If
 End With
End Sub


TextFrame.MarginLeft Property (Publisher)

 Copy code hover
[image]

TextFrame.MarginLeft Property (Publisher)
Send feedback

Returns or sets a Variant that represents the amount of space (in points) between the text and the left edge of a cell, text frame, or page. Read/write.

Syntax

expression .MarginLeft

expression A variable that represents a TextFrame object.

Example

This example sets the margins of the active publication to two inches.

Copy code Copy code
Sub SetPageMargins()

 With ActiveDocument.LayoutGuides
 .MarginTop = Application.InchesToPoints(Value:=2)
 .MarginBottom = Application.InchesToPoints(Value:=2)
 .MarginLeft = Application.InchesToPoints(Value:=2)
 .MarginRight = Application.InchesToPoints(Value:=2)
 End With

End Sub


DropCap Members (Publisher)

 Copy code hover
[image]

DropCap Members (Publisher)
Send feedback

Represents a dropped capital letter at the beginning of a paragraph.

Methods

Name | Description
ApplyCustomDropCap | Applies custom formatting to the first letters of paragraphs in a text frame.
Clear | Removes the dropped capital letter formatting.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
FontBold | Sets or returns an MsoTriState constant that represents whether the font for a dropped capital letter or WordArt text effect is bold. Read/write.
FontColor | Returns or sets a ColorFormat object that represents the color applied to a specified dropped capital letter.
FontItalic | Sets or returns an MsoTriState constant that represents whether the font for a dropped capital letter or WordArt text effect is italic. Read/write.
FontName | Sets or returns a String that represents the name of the font applied to a dropped capital letter or WordArt text effect. Read/write.
LinesUp | Returns or sets a Long that represents the number of lines an initial dropped capital letter is raised above the line of text on which it exists. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Size | Returns or sets a Long that represents the number of lines high to format a dropped capital letter. Read/write.
Span | Returns or sets a Long that represents the number of letters included in the specified dropped capital letter. Read/write.


Plates.FindPlateByInkName Method (Publisher)

 Copy code hover
[image]

Plates.FindPlateByInkName Method (Publisher)
Send feedback

Returns a Plate object that represents the plate of the specified ink name.

Version Information

Version Added: Publisher 2007

Syntax

expression .FindPlateByInkName(InkName)

expression An expression that returns a Plates object.

Parameters

Name | Required/Optional | Data Type | Description
InkName | Required | PbInkName | Specifies the plate to return.

Return Value

Plate

Remarks

The InkName parameter can be one of the PbInkName constants declared in the Microsoft Publisher type library.

Process colors are assigned different index numbers in the Plates collection than in the PrintablePlates collection. Use the FindPlateByInkName method to insure that the desired Plate or PrintablePlate object is accessed.

Example

The following example returns properties for the plate representing the third spot color defined for the active publication.

VBA Copy code Copy code
Sub ListPlatePropertiesByInkName()
Dim pplPlate As Plate

 Set pplPlate = ActiveDocument.Plates.FindPlateByInkName(pbInkNameSpot3)

 With pplPlate
 Debug.Print "Plate Name: " & .Name
 Debug.Print "Index: " & .Index
 Debug.Print "Ink Name: " & .InkName
 Debug.Print "Color: " & .Color
 Debug.Print "Luminance: " & .Luminance
 Debug.Print "In Use?: " & .InUse
 End With
End Sub


Cell.Diagonal Property (Publisher)

 Copy code hover
[image]

Cell.Diagonal Property (Publisher)
Send feedback

Sets or returns a PbCellDiagonalType constant that represents a cell that is diagonally split. Read/write.

Syntax

expression .Diagonal

expression A variable that represents a Cell object.

Return Value

PbCellDiagonalType

Remarks

The Diagonal property value can be one of the PbCellDiagonalType constants declared in the Microsoft Publisher type library.

Example

This example adds a page to the active publication, creates a table on that new page, and diagonally splits all cells in even-numbered columns.

VBA Copy code Copy code
Sub CreateNewTable()

 Dim pgeNew As Page
 Dim shpTable As Shape
 Dim tblNew As Table
 Dim celTable As Cell
 Dim rowTable As Row

 'Creates a new document with a five-row by five-column table
 Set pgeNew = ActiveDocument.Pages.Add(Count:=1, After:=1)
 Set shpTable = pgeNew.Shapes.AddTable(NumRows:=5, NumColumns:=5, _
 Left:=72, Top:=72, Width:=468, Height:=100)
 Set tblNew = shpTable.Table

 'Inserts a diagonal split into all cells in even-numbered columns
 For Each rowTable In tblNew.Rows
 For Each celTable In rowTable.Cells
 If celTable.Column Mod 2 = 0 Then
 celTable.Diagonal = pbTableCellDiagonalUp
 End If
 Next celTable
 Next rowTable

End Sub


MailMergeDataFields.Parent Property (Publisher)

 Copy code hover
[image]

MailMergeDataFields.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a MailMergeDataFields object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


PageSetup.TopMargin Property (Publisher)

 Copy code hover
[image]

PageSetup.TopMargin Property (Publisher)
Send feedback

Returns a Variant that represents the distance between the top edge of the printer sheet and the top edge of the publication pages. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .TopMargin

expression A variable that represents a PageSetup object.

Return Value

Variant

Remarks

Numeric values are evaluated as points. String values can be in any unit supported by Microsoft Publisher (for example, "2.5 in"). The valid range of possible values is from zero to the difference between the height of the sheet and the height of the publication pages.

The TopMargin property returns a value only when you print multiple pages on a single sheet of printer paper. If you attempt to use it in other circumstances, Microsoft Publisher will return nothing.


ColorSchemes Members (Publisher)

 Copy code hover
[image]

ColorSchemes Members (Publisher)
Send feedback

A collection of all the ColorScheme objects in Microsoft Publisher. Each ColorScheme object represents a color scheme, which is a set of colors that are used in a publication.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Item | Returns the specified ColorScheme object from a ColorSchemes collection. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Printer.Parent Property (Publisher)

 Copy code hover
[image]

Printer.Parent Property (Publisher)
Send feedback

Returns the parent of the Printer object. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .Parent

expression A variable that represents a Printer object.

Return Value

Object


FindReplace.MatchCase Property (Publisher)

 Copy code hover
[image]

FindReplace.MatchCase Property (Publisher)
Send feedback

Sets or returns a Boolean that represents the case sensitivity of the search operation. Read/write.

Syntax

expression .MatchCase

expression A variable that represents a FindReplace object.

Return Value

Boolean

Remarks

The default value for MatchCase is False.

Example

This example will select the first occurrence of the word "factory" regardless of case.

Copy code Copy code
With ActiveDocument.Find
 .Clear
 .MatchCase = False
 .FindText = "factory"
 .Execute
End With


Application.MailMergeRecipientListClose Event (Publisher)

 Copy code hover
[image]

Application.MailMergeRecipientListClose Event (Publisher)
See also Send feedback

Fires when the user closes the Mail Merge Recipients dialog box. (From the Mail Merge or E-mail Merge task pane, click Edit Recipient List). Also fires when the user closes the Catalog Merge Product List dialog box, which opens when the user clicks Edit Product List in the Catalog Merge task pane.

Version Information

Version Added: Publisher 2007

Syntax

expression .MailMergeRecipientListClose(Doc)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The current publication.

Remarks

For more information about using events with the Application object, see Using Events with the Application Object.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to handle the MailMergeRecipientListClose event. It displays a message notifying the user that the string described above was displayed.

VBA Copy code Copy code
Private Sub pubApplication_MailMergeRecipientListClose(ByVal Doc As Document)
 MsgBox "The Mail Merge Recipients dialog box has closed."
End Sub

For this event to occur, you must place the following line of code in the General Declarations section of your module.

VBA Copy code Copy code
Private WithEvents pubApplication As Application

Then run the following initialization procedure.

VBA Copy code Copy code
Public Sub Initialize_pubApplication()
 Set pubApplication = Publisher.Application
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


MailMergeDataSource.IsMaster Property (Publisher)

 Copy code hover
[image]

MailMergeDataSource.IsMaster Property (Publisher)
Send feedback

Indicates whether the parent MailMergeDataSource object is a master data source (a combination of all data sources connected to the current publication). Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .IsMaster

expression A variable that represents a MailMergeDataSource object.

Return Value

Boolean


TextRange.MoveEnd Method (Publisher)

 Copy code hover
[image]

TextRange.MoveEnd Method (Publisher)
Send feedback

Moves the ending character position of a range. This method returns a Long that represents the number of units the range or selection actually moved or returns 0 (zero) if the move was unsuccessful.

Syntax

expression .MoveEnd(Unit, Size)

expression A variable that represents a TextRange object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Required | PbTextUnit | The unit by which the collapsed range or selection is to be moved.
Size | Required | Long | The number of units to move. If this number is positive, the ending character position is moved forward in the document. If this number is negative, the end is moved backward. If the ending position overtakes the starting position, the range collapses and both character positions move together.

Return Value

Long

Remarks

The Unit parameter can be one of the PbTextUnit constants declared in the Microsoft Publisher type library and shown in the following table.

pbTextUnitCell

pbTextUnitCharacter

pbTextUnitCharFormat

pbTextUnitCodePoint

pbTextUnitColumn

pbTextUnitLine

pbTextUnitObject

pbTextUnitParaFormat

pbTextUnitParagraph

pbTextUnitRow

pbTextUnitScreen

pbTextUnitSection

pbTextUnitSentence

pbTextUnitStory

pbTextUnitTable

pbTextUnitWindow

pbTextUnitWord

Example

This example sets a text range, moves the range's starting and ending character positions, and then formats the font for the range.

VBA Copy code Copy code
Sub MoveStartEnd()
 Dim rngText As TextRange

 Set rngText = ActiveDocument.Pages(1).Shapes(1).TextFrame _
 .TextRange.Paragraphs(Start:=3, Length:=1)

 With rngText
 .MoveStart Unit:=pbTextUnitLine, Size:=-2
 .MoveEnd Unit:=pbTextUnitLine, Size:=1
 With .Font
 .Bold = msoTrue
 .Size = 15
 End With
 End With

End Sub


Font.Scaling Property (Publisher)

 Copy code hover
[image]

Font.Scaling Property (Publisher)
Send feedback

Returns or sets a Variant value used to scale the width of the characters in the text range as a percentage of the current font size. Read/write.

Syntax

expression .Scaling

expression A variable that represents a Font object.

Return Value

Variant

Remarks

Valid range is 0.1 to 600.0 where the number represents the percentage of current font size. Indeterminate values are returned as -2.

Example

This example scales the width of the text in the second story by 200%. For this example to work, a second story with text must exist in the active document.

VBA Copy code Copy code
Sub ScaleUp()

 Application.ActiveDocument.Stories(2).TextRange.Font.Scaling = 200

End Sub


Document.Stories Property (Publisher)

 Copy code hover
[image]

Document.Stories Property (Publisher)
Send feedback

Returns a Stories collection containing all stories in the publication.

Syntax

expression .Stories

expression A variable that represents a Document object.

Return Value

Stories

Example

This example assigns the first story in the Stories collection to a variable.

VBA Copy code Copy code
Sub FirstStory()

 Dim stFirst As Story

 stFirst = Application.ActiveDocument.Stories(1)

End Sub


MailMergeDataSource.OpenRecipientsDialog Method (Publisher)

 Copy code hover
[image]

MailMergeDataSource.OpenRecipientsDialog Method (Publisher)
Send feedback

Displays the Recipients dialog box for a mail merge publication.

Syntax

expression .OpenRecipientsDialog

expression A variable that represents a MailMergeDataSource object.

Example

This example displays the Mail Merge Recipients dialog box.

Copy code Copy code
Sub ShowRecipientsDialog()
 ActiveDocument.MailMerge.DataSource.OpenRecipientsDialog
End Sub


TextFrame.Overflowing Property (Publisher)

 Copy code hover
[image]

TextFrame.Overflowing Property (Publisher)
Send feedback

Indicates whether the text frame contains more text than can fit into the text frame. Read-only.

Syntax

expression .Overflowing

expression A variable that represents an TextFrame object.

Return Value

MsoTriState

Remarks

The Overflowing property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant

msoFalse

msoTrue

Example

This example increases the height of the selected text frame if it contains overflowing text.

VBA Copy code Copy code
Sub IncreaseTextBoxHeight()
 With Selection.ShapeRange.TextFrame
 If .Overflowing = msoTrue Then
 Do
 .Parent.Height = .Parent.Height + 36
 Loop Until .Overflowing = msoFalse
 End If
 End With
End Sub


TabStop Methods (Publisher)

 Copy code hover
[image]

TabStop Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Clear | Removes the specified custom tab stop.


TextRange.MoveStart Method (Publisher)

 Copy code hover
[image]

TextRange.MoveStart Method (Publisher)
Send feedback

Moves the start position of the specified range. This method returns a Long that indicates the number of units by which the start position or the range or selection actually moved, or it returns 0 (zero) if the move was unsuccessful.

Syntax

expression .MoveStart(Unit, Size)

expression A variable that represents a TextRange object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Required | PbTextUnit | The unit by which the collapsed range or selection is to be moved.
Size | Required | Long | The number of units to move. If this number is positive, the ending character position is moved forward in the document. If this number is negative, the end is moved backward. If the ending position overtakes the starting position, the range collapses and both character positions move together.

Return Value

Long

Remarks

The Unit parameter can be one of the PbTextUnit constants declared in the Microsoft Publisher type library and shown in the following table.

pbTextUnitCell

pbTextUnitCharacter

pbTextUnitCharFormat

pbTextUnitCodePoint

pbTextUnitColumn

pbTextUnitLine

pbTextUnitObject

pbTextUnitParaFormat

pbTextUnitParagraph

pbTextUnitRow

pbTextUnitScreen

pbTextUnitSection

pbTextUnitSentence

pbTextUnitStory

pbTextUnitTable

pbTextUnitWindow

pbTextUnitWord

Example

This example sets a text range, moves the range's starting and ending character positions, and then formats the font for the range.

VBA Copy code Copy code
Sub MoveStartEnd()
 Dim rngText As TextRange

 Set rngText = ActiveDocument.Pages(1).Shapes(1).TextFrame _
 .TextRange.Paragraphs(Start:=3, Length:=1)

 With rngText
 .MoveStart Unit:=pbTextUnitLine, Size:=-2
 .MoveEnd Unit:=pbTextUnitLine, Size:=1
 With .Font
 .Bold = msoTrue
 .Size = 15
 End With
 End With

End Sub


Page.IsLeading Property (Publisher)

 Copy code hover
[image]

Page.IsLeading Property (Publisher)
Send feedback

True if the specified Page object is a leading page of a two-page spread. Read-only Boolean.

Syntax

expression .IsLeading

expression A variable that represents an Page object.

Return Value

Boolean

Example

The following example diplays for each page whether the page is a trailing or leading page in the publication.


ColorSchemes.Item Property (Publisher)

 Copy code hover
[image]

ColorSchemes.Item Property (Publisher)
Send feedback

Returns the specified ColorScheme object from a ColorSchemes collection. Read-only.

Syntax

expression .Item(Index)

expression A variable that represents a ColorSchemes object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The color scheme to return. Can be either the name of the color scheme as a string or the corresponding PbColorScheme constant.

Remarks

The Item property value can be one of the PbColorScheme constants declared in the Microsoft Publisher type library.

Example

This example sets the color scheme of the active publication to the Aqua color scheme.

VBA Copy code Copy code
ActiveDocument.ColorScheme = ColorSchemes.Item(Index:=pbColorSchemeAqua)


Shapes.AddGroupWizard Method (Publisher)

 Copy code hover
[image]

Shapes.AddGroupWizard Method (Publisher)
Send feedback

Adds a Shape object representing a Design Gallery object to the publication.

Syntax

expression .AddGroupWizard(Wizard, Left, Top, Width, Height, Design)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
Wizard | Required | PbWizardGroup | The type of Design Gallery object to add to the publication.
Left | Required | Variant | The position of the Design Gallery object's left edge relative to the left edge of the page, measured in points.
Top | Required | Variant | The position of the Design Gallery object's top edge relative to the top edge of the page, measured in points.
Width | Optional | Variant | The width of the new Design Gallery object.
Height | Optional | Variant | The height of the new Design Gallery object.
Design | Optional | Long | The design of the object to be added.

Return Value

Shape

Remarks

The Wizard parameter can be one of the PbWizardGroup constants declared in the Microsoft Publisher type library.

Example

This example adds a Web table of contents to the active publication.

VBA Copy code Copy code
ActiveDocument.Pages(1).Shapes _
 .AddGroupWizard Wizard:=pbWizardGroupTableOfContents, _
 Left:=100, Top:=100


ThreeDFormat.Perspective Property (Publisher)

 Copy code hover
[image]

ThreeDFormat.Perspective Property (Publisher)
Send feedback

msoTrue if the extrusion appears in perspective — that is, if the walls of the extrusion narrow toward a vanishing point. msoFalse if the extrusion is a parallel, or orthographic, projection — that is, if the walls don't narrow toward a vanishing point. Read/write.

Syntax

expression .Perspective

expression A variable that represents a ThreeDFormat object.

Return Value

MsoTriState

Example

This example sets the extrusion depth for shape one on the first page to 100 points and specifies that the extrusion be parallel, or orthographic. For this example to work, the specified shape must be a 3-D shape.

VBA Copy code Copy code
Sub ChangePerspective()
 With ActiveDocument.Pages(1).Shapes(1).ThreeD
 .Visible = True
 .Depth = 100
 .Perspective = msoFalse
 End With
End Sub


Shapes.AddLabel Method (Publisher)

 Copy code hover
[image]

Shapes.AddLabel Method (Publisher)
Send feedback

Adds a new Shape object representing a text label to the specified Shapes collection.

Syntax

expression .AddLabel(Orientation, Left, Top, Width, Height)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
Orientation | Required | PbTextOrientation | The orientation of the label.
Left | Required | Variant | The position of the left edge of the shape representing the text label.
Top | Required | Variant | The position of the top edge of the shape representing the text label.
Width | Required | Variant | The width of the shape representing the text label.
Height | Required | Variant | The height of the shape representing the text label.

Return Value

Shape

Remarks

For the Left, Top, Width, and Height arguments, numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

The Orientation parameter can be one of these PbTextOrientation constants.

pbTextOrientationHorizontal | A horizontal text label for left-to-right languages.
pbTextOrientationRightToLeft | A horizontal text label for right-to-left languages.
pbTextOrientationVerticalEastAsia | A vertical text label for East Asian languages.

Example

The following example adds a new horizontal text label to the first page of the active publication.

VBA Copy code Copy code
Dim shpLabel As Shape

Set shpLabel = ActiveDocument.Pages(1).Shapes.AddLabel _
 (Orientation:=pbTextOrientationHorizontal, _
 Left:=144, Top:=144, _
 Width:=72, Height:=18)


FillFormat.Parent Property (Publisher)

 Copy code hover
[image]

FillFormat.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a FillFormat object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Row.Parent Property (Publisher)

 Copy code hover
[image]

Row.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a Row object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Field.Type Property (Publisher)

 Copy code hover
[image]

Field.Type Property (Publisher)
Send feedback

Specifies the field type. Read-only.

Syntax

expression .Type

expression A variable that represents a Field object.

Remarks

The Type property value can be one of the PbFieldType constants declared in the Microsoft Publisher type library.

Property value

PBFIELDTYPE


Shape.HorizontalFlip Property (Publisher)

 Copy code hover
[image]

Shape.HorizontalFlip Property (Publisher)
Send feedback

Indicates whether the specified shape has been flipped around its horizontal axis. Read-only.

Syntax

expression .HorizontalFlip

expression A variable that represents a Shape object.

Remarks

The HorizontalFlip property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The shape has not been flipped around its horizontal axis.
msoTriStateMixed | Indicates a combination of msoTrue and msoFalse for the specified shape.
msoTrue | The shape has been flipped around its horizontal axis.

Example

This example restores each shape on the active publication to its original state if it has been flipped horizontally or vertically.

VBA Copy code Copy code
Sub Flipper()

 Dim shpS As Shape

 For Each shpS In ActiveDocument.MasterPages.Item(1).Shapes
 If shpS.HorizontalFlip = msoTrue Then shpS.Flip msoFlipHorizontal
 If shpS.VerticalFlip = msoTrue Then shpS.Flip msoFlipVertical
 Next

End Sub


TextStyle.ParagraphFormat Property (Publisher)

 Copy code hover
[image]

TextStyle.ParagraphFormat Property (Publisher)
Send feedback

Returns a ParagraphFormat object representing the paragraph formatting for the specified text range or text style.

Syntax

expression .ParagraphFormat

expression A variable that represents a TextStyle object.

Example

The following example removes all the tab stops from the text in the first shape on page one of the active publication.

Copy code Copy code
Dim pfTemp As ParagraphFormat

Set pfTemp = ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.ParagraphFormat

pfTemp.Tabs.ClearAll


ThreeDFormat.ExtrusionColorType Property (Publisher)

 Copy code hover
[image]

ThreeDFormat.ExtrusionColorType Property (Publisher)
Send feedback

Returns or sets an MsoExtrusionColorType constant indicating whether the extrusion color is based on the extruded shape's fill (the front face of the extrusion) and automatically changes when the shape's fill changes, or whether the extrusion color is independent of the shape's fill. Read/write.

Syntax

expression .ExtrusionColorType

expression A variable that represents an ThreeDFormat object.

Return Value

MsoExtrusionColorType

Remarks

The ExtrusionColorType property value can be one of the MsoExtrusionColorType constants declared in the Microsoft Office type library.

Example

If the first shape in the active publication has an automatic extrusion color, this example gives the extrusion a custom yellow color.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes(1).ThreeD
    If .ExtrusionColorType = msoExtrusionColorAutomatic Then
        .ExtrusionColor.RGB = RGB(240, 235, 16)
    End If
End With


PageSetup.AvailablePageSizes Property (Publisher)

 Copy code hover
[image]

PageSetup.AvailablePageSizes Property (Publisher)
Send feedback

Returns the PageSizes collection that contains all the PageSize objects available in the current publication.

Version Information

Version Added: Publisher 2007

Syntax

expression .AvailablePageSizes

expression A variable that represents a PageSetup object.

Return Value

PageSizes

Remarks

PageSize objects correspond to the icons displayed under Blank Page Sizes in the Page Setup dialog box in the Microsoft Publisher user interface.

Page sizes returned by the AvailablePageSizes property include not only the page sizes provided by Microsoft Publisher, but also custom page sizes that you create or download, if any.

As you add or remove custom page sizes, the index number for all existing page sizes may change.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to create a text file that contains the list of all page sizes available in the current publication and their corresponding index numbers. It saves the text file to the Documents (in Windows Vista) or My Documents (in Windows XP) folder of the current user.

VBA Copy code Copy code
Public Sub AvailablePageSizes_Example()

 Dim pubPageSize As Publisher.PageSize
 Dim pubPageSizes As Publisher.PageSizes
 Dim intCount As Integer
 Dim lngPageSizeFile As Long

 intCount = 1

 Set pubPageSizes = ThisDocument.PageSetup.AvailablePageSizes

 lngPageSizeFile = FreeFile
 Open Environ("USERPROFILE") + "\My Documents\PageSizeList.txt" For Output Access Write As lngPageSizeFile

 For Each pubPageSize In pubPageSizes
 Write #lngPageSizeFile, pubPageSize.Name, intCount
 intCount = intCount + 1
 Next

 Close lngPageSizeFile

End Sub


MailMerge.ViewMailMergeFieldCodes Property (Publisher)

 Copy code hover
[image]

MailMerge.ViewMailMergeFieldCodes Property (Publisher)
Send feedback

True if merge field names are displayed in a mail merge publication; False if information from the current record is displayed. Read/write Boolean. .

Syntax

expression .ViewMailMergeFieldCodes

expression A variable that represents a MailMerge object.

Return Value

Boolean

Remarks

If the active publication is not a mail merge publication, using this property has no effect.

Example

This example hides the mail merge field codes in the active publication.

VBA Copy code Copy code
ActiveDocument.MailMerge.ViewMailMergeFieldCodes = False


PageSize.PageWidth Property (Publisher)

 Copy code hover
[image]

PageSize.PageWidth Property (Publisher)
Send feedback

Gets or sets the page width of the blank page size represented by the parent PageSize object. Read/write.

Version Information

Version Added: Publisher 2007

Syntax

expression .PageWidth

expression A variable that represents a PageSize object.

Return Value

Variant

Remarks

The blank page size represented by the parent PageSize object corresponds to one of the icons displayed under Blank Page Sizes in the Page Setup dialog box in the Microsoft Publisher user interface.


FillFormat.Pattern Property (Publisher)

 Copy code hover
[image]

FillFormat.Pattern Property (Publisher)
Send feedback

Returns an MsoPatternType constant that represents the pattern applied to the specified fill or line.

Syntax

expression .Pattern

expression A variable that represents a FillFormat object.

Remarks

The Pattern property value can be one of the MsoPatternType constants declared in the Microsoft Office type library.

Example

This example sets the pattern for the specified shape if the shape currently doesn't have a fill pattern. This example assumes that at least one shape exists on the first page of the active publication.

VBA Copy code Copy code
Sub ChangeFillPattern()
 With ActiveDocument.Pages(1).Shapes(1).Fill
 If .Pattern < msoPattern10Percent Then
 .Patterned Pattern:=msoPattern25Percent
 End If
 End With
End Sub


Section.PageNumberFormat Property (Publisher)

 Copy code hover
[image]

Section.PageNumberFormat Property (Publisher)
Send feedback

Sets or returns a PbPageNumberFormat constant that reperesents the formatting of the page numbering. Read/write.

Syntax

expression .PageNumberFormat

expression A variable that represents a Section object.

Return Value

PbPageNumberFormat

Remarks

The PageNumberFormat property value can be one of the PbPageNumberFormat constants declared in the Microsoft Publisher type library.

Not all of the PbPageNumberFormat constants are available, depending on the languages that are enabled or installed.

Example

This example adds a new section to the active document, sets the page number format to lowercase roman, and then sets the starting page number to 1.

VBA Copy code Copy code
Dim objSection As Section
Set objSection = ActiveDocument.Sections.Add(2)
With objSection
 .PageNumberFormat = pbPageNumberFormatLCRoman
 .PageNumberStart = 1
End With


LinkFormat Object (Publisher)

 Copy code hover
[image]

LinkFormat Object (Publisher)
Send feedback

Represents the linking characteristics for an OLE object or picture.

Remarks

Not all types of shapes and fields can be linked to a source. Use the Type property for the Shape object to determine whether a particular shape can be linked.

Use the Update method to update links. To return or set the full path for a particular link's source file, use the SourceFullName property.

Example

Use the LinkFormat property for a shape or field to return a LinkFormat object. The following example updates the links to all linked OLE objects on the first page of the active publication.

Copy code Copy code
Sub FindOLEObjects()
 Dim shpShape As Shape

 For Each shpShape In ActiveDocument.Pages(1).Shapes
 If shpShape.Type = pbLinkedOLEObject Then
 shpShape.LinkFormat.Update
 End If
 Next shpShape
End Sub


WebNavigationBarSets.AddSet Method (Publisher)

 Copy code hover
[image]

WebNavigationBarSets.AddSet Method (Publisher)
Send feedback

Adds a new WebNavigationBarSet object representing a Web navigation bar set to the specified WebNavigationBarSets collection. .

Syntax

expression .AddSet(Name, Design, AutoUpdate)

expression A variable that represents a WebNavigationBarSets object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the Web navigation bar to be added. This parameter must be unique.
Design | Optional | PbWizardNavBarDesign | Specifies the navigation bar design scheme.
AutoUpdate | Optional | Boolean | True if all pages with the AddHyperlinkToWebNavBar property set to True are added as links to the navigation bar and the navigation bar is kept updated.

Return Value

WebNavigationBarSet

Remarks

The Name parameter must be unique to avoid a run time error.

Example

The following example adds a WebNavigationBarSet object to the WebNavigationBarSets collection of the active document then sets some properties.

Copy code Copy code
Dim objWebNavBarSet As WebNavigationBarSet

Set objWebNavBarSet = ActiveDocument.WebNavigationBarSets.AddSet( _
 Name:="WebNavBarSet1", _
 Design:=pbnbDesignAmbient, _
 AutoUpdate:=True)

With objWebNavBarSet
 .AddToEveryPage Left:=50, Top:=10
 .ButtonStyle = pbnbDesignTopLine
 .ChangeOrientation pbNavBarOrientHorizontal
End With


ShapeNodes.Count Property (Publisher)

 Copy code hover
[image]

ShapeNodes.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a ShapeNodes object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


Document.EndCustomUndoAction Method (Publisher)

 Copy code hover
[image]

Document.EndCustomUndoAction Method (Publisher)
Send feedback

Specifies the endpoint of a group of actions that are wrapped to create a single undo action. The BeginCustomUndoAction Method method is used to specify the starting point and label (textual description) of the actions used to create the single undo action. The wrapped group of actions can be undone with a single undo.

Syntax

expression .EndCustomUndoAction

expression A variable that represents a Document object.

Remarks

The BeginCustomUndoAction method must be called before the EndCustomUndoAction method is called. A run-time error is returned if EndCustomUndoAction is called before BeginCustomUndoAction.

Example

The following example contains two custom undo actions. The first one is created on page four of the active publication. The BeginCustomUndoAction method is used to specify the point at which the custom undo action should begin. Six individual actions are performed, and then they are wrapped into one action with the call to EndCustomUndoAction.

The text in the text frame that was created within the first custom undo action is then tested to determine whether the font is Verdana. If not, the Undo method is called with UndoActionsAvailable passed as a parameter. In this case there is only one undo action available. So, the call to Undo will undo only one action, but this one action has wrapped six actions into one.

A second undo action is then created, and it could also be undone later with a single undo operation.

This example assumes that the active publication contains at least four pages.

Copy code Copy code
Dim thePage As page
Dim theShape As Shape
Dim theDoc As Publisher.Document

Set theDoc = ActiveDocument
Set thePage = theDoc.Pages(4)

With theDoc
 ' The following six of actions are wrapped to create one
 ' custom undo action named "Add Rectangle and Courier Text".
 .BeginCustomUndoAction ("Add Rectangle and Courier Text")
 With thePage
 Set theShape = .Shapes.AddShape(msoShapeRectangle, _
 75, 75, 190, 30)
 With theShape.TextFrame.TextRange
 .Font.Size = 14
 .Font.Bold = msoTrue
 .Font.Name = "Courier"
 .Text = "This font is Courier."
 End With
 End With
 .EndCustomUndoAction

 If Not thePage.Shapes(1).TextFrame.TextRange.Font.Name = "Verdana" Then
 ' This call to Undo will undo all actions that are available.
 ' In this case, there is only one action that can be undone.
 .Undo (.UndoActionsAvailable)
 ' A new custom undo action is created with a name of
 ' "Add Balloon and Verdana Text".
 .BeginCustomUndoAction ("Add Balloon and Verdana Text")
 With thePage
 Set theShape = .Shapes.AddShape(msoShapeBalloon, _
 75, 75, 190, 30)
 With theShape.TextFrame.TextRange
 .Font.Size = 11
 .Font.Name = "Verdana"
 .Text = "This font is Verdana."
 End With
 End With
 .EndCustomUndoAction
 End If
End With


TextFrame.NextLinkedTextFrame Property (Publisher)

 Copy code hover
[image]

TextFrame.NextLinkedTextFrame Property (Publisher)
Send feedback

Returns or sets a TextFrame object representing the text frame to which text flows from the specified text frame. Read/write.

Syntax

expression .NextLinkedTextFrame

expression A variable that represents a TextFrame object.

Return Value

TextFrame

Remarks

If the specified text frame is not part of a chain of linked frames or is the last in a chain of linked frames, this property returns nothing.

Example

The following example returns the next linked text frame of shape three on page one of the active publication and sets its font to Times New Roman.

Copy code Copy code
Dim txtFrame As TextFrame

Set txtFrame = ActiveDocument.Pages(1) _
 .Shapes(3).TextFrame.NextLinkedTextFrame

txtFrame.TextRange.Font = "Times New Roman"


TabStops.Count Property (Publisher)

 Copy code hover
[image]

TabStops.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a TabStops object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


Cell Object (Publisher)

 Copy code hover
[image]

Cell Object (Publisher)
Send feedback

Represents a single table cell. The Cell object is a member of the CellRange collection. The CellRange collection represents all the cells in the specified object.

Example

Use Cells(index), where index is the cell number, to return a Cell object. This example merges the first two cells of the first column of the specified table.

Copy code Copy code
Sub MergeCell()
 With ActiveDocument.Pages(1).Shapes(2).Table.Columns(1)
 .Cells(1).Merge MergeTo:=.Cells(2)
 End With
End Sub

This example applies a thick border around the first cell in the second column of the specified table.

Copy code Copy code
Sub OutlineBorderCell()
 With ActiveDocument.Pages(1).Shapes(2).Table.Columns(2).Cells(1)
 .BorderLeft.Weight = 5
 .BorderRight.Weight = 5
 .BorderTop.Weight = 5
 .BorderBottom.Weight = 5
 End With
End Sub


Options.AllowBackgroundSave Property (Publisher)

 Copy code hover
[image]

Options.AllowBackgroundSave Property (Publisher)
Send feedback

True (default) for Microsoft Publisher to save publications in the background, allowing users to perform other actions at the same time. Read/write Boolean.

Syntax

expression .AllowBackgroundSave

expression A variable that represents an Options object.

Return Value

Boolean

Remarks

This setting is saved for each individual user and persists from one session to another.

Example

This example turns off background save, so publications do not save in the background.

Copy code Copy code
Sub DoNotSaveInBackground()
 Options.AllowBackgroundSave = False
End Sub


AdvancedPrintOptions.ManualFeedAlign Property (Publisher)

 Copy code hover
[image]

AdvancedPrintOptions.ManualFeedAlign Property (Publisher)
See also Send feedback

Gets or sets the alignment (left, right, or center) of where envelopes are fed to the printer's manual feed. Read/write.

Version Information

Version Added: Publisher 2007

Syntax

expression .ManualFeedAlign

expression A variable that represents an AdvancedPrintOptions object.

Return Value

PbPlacementType

Remarks

The ManualFeedAlign property setting, in conjunction with the AdvancedPrintOptions.ManualFeedDirection property setting, corresponds to the Envelope feed method setting in the Envelope Setup dialog box in the Microsoft Publisher user interface. (On the File menu, click Print Setup. On the Printer Details tab, click Advanced Printer Setup. On the Printer Setup Wizard tab, click Envelope Setup Dialog).

Possible values for ManualFeedAlign are pbPlacementCenter (3), pbPlacementLeft (1), and pbPlacementRight (2).

See also

Concepts

AdvancedPrintOptions Object

Other resources

AdvancedPrintOptions Object Members


Shape.IsInline Property (Publisher)

 Copy code hover
[image]

Shape.IsInline Property (Publisher)
Send feedback

Returns an MsoTriState constant that specifies whether a shape is inline (contained in a text run). Read-only.

Syntax

expression .IsInline

expression A variable that represents a Shape object.

Example

This example tests the first shape (a text frame) on the first page of the publication to see if it is inline. If it is not, a search is done within that shape to find any inline shapes within the text frame. Any inline shapes that are found have the ForeColor property set to red.

Copy code Copy code
Dim theShape As Shape
Dim i As Integer

Set theShape = ActiveDocument.Pages(1).Shapes(1)

If Not theShape.IsInline = True Then
 With theShape.TextFrame.Story.TextRange
 If .InlineShapes.Count > 0 Then
 For i = 1 To .InlineShapes.Count
 .InlineShapes(i).Select
 .InlineShapes(i).Fill.ForeColor.RGB = vbRed
 Next
 End If
 End With
End If


FindReplace.FindText Property (Publisher)

 Copy code hover
[image]

FindReplace.FindText Property (Publisher)
Send feedback

Sets or retrieves a String representing the text to find in the specified range or selection. Read/write.

Syntax

expression .FindText

expression A variable that represents a FindReplace object.

Return Value

String

Remarks

The FindText property returns the plain, unformatted text of the selection. When you set this property, the search text is specified. You can search for special characters by specifying appropriate character codes. For example, "^p" corresponds to a paragraph mark and "^t" corresponds to a tab character.

The default value for the FindText property is an empty string. Because only text searching is supported, FindText must be explicitly set to avoid a runtime error.

Example

This example replaces all occurrences of the word "This" in the selection with "That" in each open publication.

Copy code Copy code
Dim objDocument As Document

For Each objDocument In Documents
 With objDocument.Find
 .Clear
 .MatchCase = True
 .FindText = "This"
 .ReplaceWithText = "That"
 .ReplaceScope = pbReplaceScopeAll
 .Forward = True
 .Execute
 End With
Next objDocument


CatalogMergeShapes Members (Publisher)

 Copy code hover
[image]

CatalogMergeShapes Members (Publisher)
Send feedback

Represents the shapes contained in the catalog merge area of the specified publication.

Methods

Name | Description
Item | Returns an individual object in a specified collection.
Range | Returns a ShapeRange object that represents a subset of the shapes in a Shapes collection.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
HorizontalRepeat | Returns a Long that represents the number of times the catalog merge area will repeat across the target publication page when the catalog merge is executed. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
VerticalRepeat | Returns a Long that represents the number of times the catalog merge area will repeat down the target publication page when the catalog merge is executed. Read-only.


ShadowFormat.IncrementOffsetX Method (Publisher)

 Copy code hover
[image]

ShadowFormat.IncrementOffsetX Method (Publisher)
Send feedback

Incrementally changes the horizontal offset of the shadow by the specified distance.

Syntax

expression .IncrementOffsetX(Increment)

expression A variable that represents a ShadowFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Variant | Specifies how far the shadow offset is to be moved horizontally. A positive value moves the shadow to the right; a negative value moves it to the left. Numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

Remarks

Use the OffsetX property to set the absolute horizontal shadow offset.

Use the IncrementOffsetY method to change a shadow's vertical offset.

Example

This example moves the shadow for the third shape in the active publication to the left by 3 points.

Copy code Copy code
ActiveDocument.Pages(1).Shapes(3).Shadow _
 .IncrementOffsetX Increment:=-3


WizardProperties Members (Publisher)

 Copy code hover
[image]

WizardProperties Members (Publisher)
Send feedback

Represents the settings available in a publication design or in a Design Gallery object's wizard.

Methods

Name | Description
FindPropertyById | Returns a WizardProperty object, based on the specified ID, from the collection of wizard properties associated with a publication design or a Design Gallery object's wizard.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Item | Returns an individual object from a specified collection. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Page.Wizard Property (Publisher)

 Copy code hover
[image]

Page.Wizard Property (Publisher)
Send feedback

Returns a Wizard object representing the publication design associated with the specified publication or the wizard associated with the specified Design Gallery object.

Syntax

expression .Wizard

expression A variable that represents a Page object.

Remarks

When accessing the Wizard property from the Document or Page object, if the specified publication is not associated with any publication design, an error occurs. When accessing the Wizard property from the Shape or ShapeRange object, if the specified object is not a Design Gallery object, an error occurs.

Example

The following example reports on the publication design associated with the active publication, displaying its name and current settings.

Copy code Copy code
Dim wizTemp As Wizard
Dim wizproTemp As WizardProperty
Dim wizproAll As WizardProperties

Set wizTemp = ActiveDocument.Wizard

With wizTemp
 Set wizproAll = .Properties
 Debug.Print "Publication design associated with " _
 & "current publication: " _
 & .Name
 For Each wizproTemp In wizproAll
 With wizproTemp
 Debug.Print " Setting: " _
 & .Name & " = " & .CurrentValueId
 End With
 Next wizproTemp
End With
Note Note

Depending on the language version of Publisher that you are using, you may receive an error when using the above code. If this occurs, you will need to build in error handlers to circumvent the errors. For more information, see Wizard object .


WrapFormat.DistanceTop Property (Publisher)

 Copy code hover
[image]

WrapFormat.DistanceTop Property (Publisher)
Send feedback

When the Type property of the WrapFormat object is set to pbWrapTypeSquare, returns or sets a Variant that represents the distance (in points) between the document text and the top edge of the specified shape. Read/write.

Syntax

expression .DistanceTop

expression A variable that represents a WrapFormat object.

Example

This example adds an oval to the active document and specifies that the document text wrap around the left and right sides of the square that circumscribes the oval. The example sets a 0.1-inch margin between the document text and the top, bottom, left side, and right side of the square.

Copy code Copy code
Sub AddNewShape()
 Dim shpOval As Shape

 Set shpOval = ActiveDocument.Pages(1).Shapes _
 .AddShape(Type:=msoShapeOval, Left:=36, _
 Top:=36, Width:=100, Height:=35)
 With shpOval.TextWrap
 .Type = pbWrapTypeSquare
 .Side = pbWrapSideBoth
 .DistanceAuto = msoFalse
 .DistanceTop = InchesToPoints(0.1)
 .DistanceBottom = InchesToPoints(0.1)
 .DistanceLeft = InchesToPoints(0.1)
 .DistanceRight = InchesToPoints(0.1)
 End With
End Sub


Application.PixelsToPoints Method (Publisher)

 Copy code hover
[image]

Application.PixelsToPoints Method (Publisher)
See also Send feedback

Converts a measurement from pixels to points (1 pixel = 0.75 points). Returns the converted measurement as a Single.

Syntax

expression .PixelsToPoints(Value)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Value | Required | Single | The pixel value to be converted to points.

Return Value

Single

Remarks

Use the PointsToPixels method to convert measurements in points to pixels.

Example

This example converts measurements in pixels entered by the user to measurements in points.

Copy code Copy code
Dim strInput As String
Dim strOutput As String

Do While True
 ' Get input from user.
 strInput = InputBox( _
 Prompt:="Enter measurement in pixels (0 to cancel): ", _
 Default:="0")

 ' Exit the loop if user enters zero.
 If Val(strInput) = 0 Then Exit Do

 ' Evaluate and display result.
 strOutput = Trim(strInput) & " pixels = " _
 & Format(Application _
 .PixelsToPoints(Value:=Val(strInput)), _
 "0.00") & " points"

 MsgBox strOutput
Loop

See also

Concepts

Application Object

Other resources

Application Object Members


ShapeRange.InlineTextRange Property (Publisher)

 Copy code hover
[image]

ShapeRange.InlineTextRange Property (Publisher)
Send feedback

Returns a TextRange object that reflects the position of the inline shape in its containing text range. Read-only.

Syntax

expression .InlineTextRange

expression A variable that represents a ShapeRange object.

Remarks

The returned text range will contain a single object representing the inline shape. An automation error is returned if the shape is not inline.

Example

The following example finds the first shape (a text box) on the first page of the publication, and determines if the text range within the text box contains inline shapes. If inline shapes are found, the InlineTextRange property is used to represent the inline shape after a block of text is inserted.

Copy code Copy code
Dim theShape As Shape
Dim theTextRange As TextRange
Dim i As Integer

Set theShape = ActiveDocument.Pages(1).Shapes(1)

If Not theShape.IsInline = True Then
 With theShape.TextFrame.Story.TextRange
 If .InlineShapes.Count > 0 Then
 Set theTextRange = theShape.TextFrame.Story.TextRange
 For i = 1 To .InlineShapes.Count
 With .InlineShapes(i)
 .InlineTextRange.InsertAfter (" (Figure " & i & ") ")
 End With
 Next
 End If
 End With
End If


PbTextUnit Enumeration (Publisher)

 Copy code hover
[image]

PbTextUnit Enumeration (Publisher)
Send feedback

The unit by which to expand a range.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbTextUnitCell | 12 | Expand by a cell
pbTextUnitCharacter | 1 | Expand by a character
pbTextUnitCharFormat | 13 | Expand by a CharFormat
pbTextUnitCodePoint | 17 | Expand by a code point
pbTextUnitColumn | 9 | Expand by a unit column
pbTextUnitLine | 5 | Expand by a unit line
pbTextUnitObject | 16 | Expand by an object
pbTextUnitParaFormat | 14 | Expand by a ParaFormat
pbTextUnitParagraph | 4 | Expand by a paragraph
pbTextUnitRow | 10 | Expand by a row
pbTextUnitScreen | 7 | Expand by a screen
pbTextUnitSection | 8 | Expand by a section
pbTextUnitSentence | 3 | Expand by a sentence
pbTextUnitStory | 6 | Expand by a story
pbTextUnitTable | 15 | Expand by a table
pbTextUnitWindow | 11 | Expand by a window
pbTextUnitWord | 2 | Expand by a word


Application.MailMergeGenerateBarcode Event (Publisher)

 Copy code hover
[image]

Application.MailMergeGenerateBarcode Event (Publisher)
See also Send feedback

Occurs when Microsoft Publisher requires data to generate barcodes in a mail-merge publication, in particular when the mail-merge recipient list changes.

Version Information

Version Added: Publisher 2007

Syntax

expression .MailMergeGenerateBarcode(Doc, bstrString)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The current publication.
bstrString | Required | String | Output parameter. A string representation of the barcode.

Remarks

Third-party add-ins that validate mail-merge addresses can use the MailMergeGenerateBarcode event to listen for user actions requesting that barcodes be generated. In this situation, when the add-in receives notification that the MailMergeGenerateBarcode event fired, and if the active document is connected to a data source, the add-in can use the MailMergeDataSource.ActiveRecord property to determine the record for which to generate the barcode. If the active document is not connected to a data source, the add-in uses the address text directly.

If the add-in can use the address text directly, it returns a string representation of the barcode for the bstrString output parameter. If the add-in cannot use the address text directly, it returns an empty string.

To permit triggering of the MailMergeGenerateBarcode event, you must handle the MailMergeInsertBarcode event in your code, and the add-in must set the OkToInsert parameter passed to that event to True.

For more information about using events with the Application object, see Using Events with the Application Object.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to handle the MailMergeGenerateBarcode event. It returns the string that represents the barcode for active record. Note that the variable indexNumberOfBarcodeColumn represents the index number of the column in the data source that lists barcodes. This code assumes that the current publication is connected to a data source.

VBA Copy code Copy code
Private Sub pubApplication_MailMergeGenerateBarcode(ByVal Doc As Document, bstrString As String)
 bstrString = pubApplication.ActiveDocument.MailMerge.DataSource.DataFields.Item(indexNumberOfBarcodeColumn).Value
End Sub

For this event to occur, you must place the following line of code in the General Declarations section of your module.

VBA Copy code Copy code
Public WithEvents pubApplication As Application

Then run the following initialization procedure.

VBA Copy code Copy code
Public Sub Initialize_pubApplication()
 Set pubApplication = Publisher.Application
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


LayoutGuides.MarginRight Property (Publisher)

 Copy code hover
[image]

LayoutGuides.MarginRight Property (Publisher)
Send feedback

Returns or sets a Variant that represents the amount of space (in points) between the text and the right edge of a cell, text frame, or page. Read/write.

Syntax

expression .MarginRight

expression A variable that represents a LayoutGuides object.

Example

This example sets the margins of the active publication to two inches.

Copy code Copy code
Sub SetPageMargins()

 With ActiveDocument.LayoutGuides
 .MarginTop = Application.InchesToPoints(Value:=2)
 .MarginBottom = Application.InchesToPoints(Value:=2)
 .MarginLeft = Application.InchesToPoints(Value:=2)
 .MarginRight = Application.InchesToPoints(Value:=2)
 End With

End Sub


Shape.SaveAsBuildingBlock Method (Publisher)

 Copy code hover
[image]

Shape.SaveAsBuildingBlock Method (Publisher)
Send feedback

Saves a single shape as a building block. Returns the resulting BuildingBlock object.

Version Information

Version Added: Publisher 2010

Syntax

expression .SaveAsBuildingBlock(Name)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the new building block you want to create.


WebPageOptions.IncludePageOnNewWebNavigationBars Property (Publisher)

 Copy code hover
[image]

WebPageOptions.IncludePageOnNewWebNavigationBars Property (Publisher)
Send feedback

Returns or sets a Boolean value that specifies whether a link to a Web page will be added to the automatic navigation bars of new pages. Read/write.

Syntax

expression .IncludePageOnNewWebNavigationBars

expression A variable that represents an WebPageOptions object.

Return Value

Boolean

Remarks

The default value of the IncludePageOnNewWebNavigationBars property is False, which means that links to the specified page will not be added to the automatic navigation bars of new pages.

Setting this property to False does not remove links to the specified page from any automatic navigation bars that already include them, but it does prevent links to the page from being added to automatic navigation bars of new pages.

Setting this property to True applies only to automatic navigation bars of new pages, and does not update existing automatic navigation bars within the Web publication.

When adding a new page to the Web publication by using the Pages.Add method, the optional AddHyperlinkToWebNavBar parameter can be used to specify whether links to the new page will be added to existing automatic navigation bars. The value of this parameter is used to populate the value of the IncludePageOnNewWebNavigationBars property.

Example

The following example specifies that links to page two of the active Web publication should be added to the automatic navigation bars of new pages. Note that if a new page is added to the publication after this point, the IncludePageOnNewWebNavigationBars property will be False.

Copy code Copy code
Dim theWPO As WebPageOptions

Set theWPO = ActiveDocument.Pages(2).WebPageOptions
With theWPO
 .IncludePageOnNewWebNavigationBars = True
End With

The following example demonstrates adding two new pages to the publication by using the Pages.Add method. The AddHyperlinkToWebNavBar parameter is set to True, which specifies that links to these two new pages be added to the automatic navigation bars of existing pages.

Another page is then added to the publication, and the AddHyperlinkToWebNavBar is omitted. This means that the IncludePageOnNewWebNavigationBars property is False for the newly added page, and links to this page will not be included in the automatic navigation bars of existing pages.

Copy code Copy code
Dim thePage As page
Dim thePage2 As page

Set thePage = ActiveDocument.Pages.Add(Count:=2, _
 After:=4, AddHyperlinkToWebNavBar:=True)

Set thePage2 = ActiveDocument.Pages.Add(Count:=1, After:=6)


PbTableAutoFormatType Enumeration (Publisher)

 Copy code hover
[image]

PbTableAutoFormatType Enumeration (Publisher)
Send feedback

The type of automatic formatting to apply to the specified table.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbTableAutoFormatCheckbookRegister | 0 | Checkbook register
pbTableAutoFormatCheckerboard | 20 | Checkerboard
pbTableAutoFormatDefault | -3 | Default
pbTableAutoFormatList1 | 1 | AutoFormatList1
pbTableAutoFormatList2 | 2 | AutoFormatList2
pbTableAutoFormatList3 | 3 | AutoFormatList3
pbTableAutoFormatList4 | 4 | AutoFormatList4
pbTableAutoFormatList5 | 5 | AutoFormatList5
pbTableAutoFormatList6 | 6 | AutoFormatList6
pbTableAutoFormatList7 | 7 | AutoFormatList7
pbTableAutoFormatListWithTitle1 | 8 | Auto Format List with Title1
pbTableAutoFormatListWithTitle2 | 9 | Auto Format List with Title2
pbTableAutoFormatListWithTitle3 | 10 | Auto Format List with Title3
pbTableAutoFormatMixed | -1 | Auto Format mixed
pbTableAutoFormatNone | -2 | Auto Format none
pbTableAutoFormatNumbers1 | 11 | Auto Format Numbers1
pbTableAutoFormatNumbers2 | 12 | Auto Format Numbers2
pbTableAutoFormatNumbers3 | 13 | Auto Format Numbers3
pbTableAutoFormatNumbers4 | 14 | Auto Format Numbers4
pbTableAutoFormatNumbers5 | 15 | Auto Format Numbers5
pbTableAutoFormatNumbers6 | 16 | Auto Format Numbers6
pbTableAutoFormatTableOfContents1 | 17 | Auto Format Table Of Contents1
pbTableAutoFormatTableOfContents2 | 18 | Auto Format Table Of Contents2
pbTableAutoFormatTableOfContents3 | 19 | Auto Format Table Of Contents3


PageBackground.Exists Property (Publisher)

 Copy code hover
[image]

PageBackground.Exists Property (Publisher)
Send feedback

True if the specified PageBackground object exists. Read/write Boolean.

Syntax

expression .Exists

expression A variable that represents a PageBackground object.


Tags.Item Method (Publisher)

 Copy code hover
[image]

Tags.Item Method (Publisher)
Send feedback

Returns an individual object in a specified collection.

Syntax

expression .Item(Index)

expression A variable that represents a Tags object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The number or name of the field or list box item to return.

Return Value

Tag


ThreeDFormat.PresetMaterial Property (Publisher)

 Copy code hover
[image]

ThreeDFormat.PresetMaterial Property (Publisher)
Send feedback

Returns or sets an MsoPresetMaterial constant that represents the extrusion surface material. Read/write.

Syntax

expression .PresetMaterial

expression A variable that represents a ThreeDFormat object.

Return Value

MsoPresetMaterial

Remarks

The PresetMaterial property value can be one of the MsoPresetMaterial constants declared in the Microsoft Office type library.

Example

This example specifies that the extrusion surface for shape one in the active publication be a wireframe. For this example to work, the specified shape must be a 3-D shape.

VBA Copy code Copy code
Sub SetExtrusionMaterial()
 With ActiveDocument.Pages(1).Shapes(1).ThreeD
 .Visible = True
 .PresetMaterial = msoMaterialWireFrame
 End With
End Sub


Options.AutoKeyboardSwitching Property (Publisher)

 Copy code hover
[image]

Options.AutoKeyboardSwitching Property (Publisher)
Send feedback

True for Microsoft Publisher to automatically switch the keyboard language to the language used for the text at the cursor position. Read/write Boolean.

Syntax

expression .AutoKeyboardSwitching

expression A variable that represents an Options object.

Return Value

Boolean

Example

This example enables automatically switching the keyboard language to the necessary language.

Copy code Copy code
Sub SetGlobalOptions()
 Options.AutoKeyboardSwitching = True
End Sub


ShapeNodes.Application Property (Publisher)

 Copy code hover
[image]

ShapeNodes.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a ShapeNodes object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


WebCommandButton.DataFileName Property (Publisher)

 Copy code hover
[image]

WebCommandButton.DataFileName Property (Publisher)
Send feedback

Returns or sets a String that represents the name of the file in which to save data from a Web form. Read/write.

Syntax

expression .DataFileName

expression A variable that represents a WebCommandButton object.

Return Value

String

Example

This example sets Microsoft Publisher to process Web form data by saving it to a comma-delimited text file on the same Web server as the form is stored.

Copy code Copy code
Sub WebDataFile()
 With ThisDocument.Pages(1).Shapes(1).WebCommandButton
 .DataRetrievalMethod = pbSubmitDataRetrievalSaveOnServer
 .DataFileFormat = pbSubmitDataFormatCSV
 .DataFileName = "WebFormData.txt"
 End With
End Sub


Hyperlink.Type Property (Publisher)

 Copy code hover
[image]

Hyperlink.Type Property (Publisher)
Send feedback

Returns an MsoHyperlinkType constant that represents the hyperlink type. Read-only.

Syntax

expression .Type

expression A variable that represents a Hyperlink object.

Remarks

The Type property value can be one of these MsoHyperlinkType constants.

msoHyperlinkInlineShape

msoHyperlinkRange

msoHyperlinkShape


MailMergeMappedDataField.Application Property (Publisher)

 Copy code hover
[image]

MailMergeMappedDataField.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a MailMergeMappedDataField object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


PictureFormat Methods (Publisher)

 Copy code hover
[image]

PictureFormat Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
ClearCrop | Removes a picture shape from an image, and resets the crop region to the original extent of the image before cropping. Returns nothing.
FillFrame | Fills the frame of a picture with the image represented by the PictureFormat object. Returns nothing.
FitFrame | Fits the image represented by the PictureFormat object to the frame of the picture. Returns nothing.
IncrementBrightness | Changes the brightness of the picture by the specified amount.
IncrementContrast | Changes the contrast of the picture by the specified amount.
Recolor | Changes the color of a picture in a publication.
Remove | Removes the picture from its frame, leaving in its place a picture placeholder. Any previous formatting applied to the picture is retained. Returns nothing.
Replace | Replaces the specified picture. Returns Nothing.
ReplaceEx | Replaces the specified picture, optionally fitting the replacement picture to the frame or filling the frame. Returns nothing.
RestoreOriginalColors | Restores the original colors of a picture that was recolored.


MailMergeDataField.Application Property (Publisher)

 Copy code hover
[image]

MailMergeDataField.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a MailMergeDataField object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


PageSize Properties (Publisher)

 Copy code hover
[image]

PageSize Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the creator of the parent PageSize object. Read-only.
HasBackgroundImage | Returns True if the blank page size represented by the parent PageSize object has a background image. Read-only.
HorizontalGap | Returns a Variant that represents the distance between the right edge of one publication page and left edge of the next publication page in the same row in the blank page size represented by the parent PageSize object when multiple pages are printed on one sheet of printer paper. Read-only.
LeftMargin | Specifies the distance between the left edge of the printer sheet and the top edge of the publication page in the blank page size represented by the parent PageSize object. Read-only.
Name | Returns the name of the blank page size represented by the parent PageSize object. Read-only.
PageHeight | Gets or sets the page height of the blank page size represented by the parent PageSize object. Read/write.
PageWidth | Gets or sets the page width of the blank page size represented by the parent PageSize object. Read/write.
Parent | Returns the parent of the PageSize object. Read-only.
TopMargin | Specifies the distance between the top edge of the printer sheet and the top edge of the publication page for the blank page size represented by the parent PageSize object. Read-only.
VerticalGap | Returns a Variant that represents the distance in points between the bottom edge of one publication page and top edge of the publication page immediately below it for the blank page size represented by the parent PageSize object. This property applies only when multiple pages are printed on a single sheet of printer paper. Read-only.


Column Methods (Publisher)

 Copy code hover
[image]

Column Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified object.


Application.MailMergeInsertBarcode Event (Publisher)

 Copy code hover
[image]

Application.MailMergeInsertBarcode Event (Publisher)
See also Send feedback

Occurs when the user issues the command to insert postal barcodes into a mail-merge publication, either in the Microsoft Publisher user interface (UI), or programmatically.

Version Information

Version Added: Publisher 2007

Syntax

expression .MailMergeInsertBarcode(Doc, OkToInsert)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The current publication.
OkToInsert | Required | Boolean | Output parameter. True if it is okay to insert barcodes.

Remarks

You can use the InsertBarcode method to insert barcodes into a mail merge publication.

Third-party add-ins that validate mail-merge addresses can use the MailMergeInsertBarcode event to listen for user actions requesting that barcodes be inserted. In this situation, when the add-in receives notification that the MailMergeInsertBarcode event fired, it checks the validity of the addresses in the mail-merge list, and if the addreses are valid, it attempts to generate barcodes. If this attempt is successful, the add-in should return True for the OkToInsert parameter. If the attempt fails, the add-in should return False.

Actual barcode data is provided to Publisher by the MailMergeGenerateBarcode event.

The MailMergeInsertBarcode event is also triggered when a user clicks Add a postal barcode in the Mail Merge or Catalog Merge task pane, or Add postal bar codes in the Publisher Tasks task pane in the Publisher UI. Before a user can click either of these UI commands, you must first make them available by setting the InsertBarcodeVisible property to True.

For more information about using events with the Application object, see Using Events with the Application Object.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to handle the MailMergeInsertBarcode event. It displays a message asking whether to proceed with inserting barcodes.

VBA Copy code Copy code
Private Sub pubApplication_MailMergeInsertBarcode(ByVal Doc As Document, OkToInsert As Boolean)

 Dim intResponse As Integer

 intResponse = MsgBox("Proceed to insert barcodes?", vbYesNo)

 If intResponse = vbYes Then OkToInsert = True

End Sub

For this event to occur, you must place the following line of code in the General Declarations section of your module.

VBA Copy code Copy code
Public WithEvents pubApplication As Application

Then run the following initialization procedure.

VBA Copy code Copy code
Public Sub Initialize_pubApplication()
 Set pubApplication = Publisher.Application
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


BorderArtFormat.RevertToOriginalColor Method (Publisher)

 Copy code hover
[image]

BorderArtFormat.RevertToOriginalColor Method (Publisher)
See also Send feedback

Sets the BorderArt on the specified shape back to its default color.

Syntax

expression .RevertToOriginalColor

expression A variable that represents a BorderArtFormat object.

Remarks

The RevertToOriginalColor method has the same effect as the Default selection on the Color control on the Format <Shape> dialog box.

Use the Color property of the BorderArtFormat object to set the BorderArt to a color other than the original color.

Example

The following example tests for the existence of BorderArt on each shape for each page of the active document. If BorderArt exists, its weight is set to the default thickness and original color.

Copy code Copy code
Sub RestoreBorderArtDefaults()

Dim anyPage As Page
Dim anyShape As Shape

For Each anyPage in ActiveDocument.Pages
 For Each anyShape in anyPage.Shapes
 With anyShape.BorderArt
 If .Exists = True Then
 .RevertToDefaultWeight
 .RevertToOriginalColor
 End If
 End With
 Next anyShape
Next anyPage
End Sub

See also

Concepts

BorderArtFormat Object

Other resources

BorderArtFormat Object Members


ThreeDFormat.ContourWidth Property (Publisher)

 Copy code hover
[image]

ThreeDFormat.ContourWidth Property (Publisher)
See also Send feedback

Returns or sets a Single that represents the width of the contour of a shape. Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .ContourWidth

expression A variable that represents a ThreeDFormat object.

Return value

Single

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ColorFormat.BaseCMYK Property (Publisher)

 Copy code hover
[image]

ColorFormat.BaseCMYK Property (Publisher)
Send feedback

Returns the base cyan-magenta-yellow-black (CMYK) color value of the parent ColorFormat object before any tinting or shading is applied to the color. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .BaseCMYK

expression A variable that represents a ColorFormat object.

Return Value

ColorCMYK


Column.Cells Property (Publisher)

 Copy code hover
[image]

Column.Cells Property (Publisher)
Send feedback

Returns a CellRange object that represents the cell or cells in a column of a table.

Syntax

expression .Cells

expression A variable that represents a Column object.

Example

This example merges the first and second cells in the first column of the specified table.

VBA Copy code Copy code
Sub MergeCell()
 With ActiveDocument.Pages(1).Shapes(2).Table.Columns(1)
 .Cells(1).Merge MergeTo:=.Cells(2)
 End With
End Sub

This example applies a thick border outline to the first cell in the second column of the specified table.

VBA Copy code Copy code
Sub OutlineBorderCell()
 With ActiveDocument.Pages(1).Shapes(2).Table.Columns(2).Cells(1)
 .BorderLeft.Weight = 5
 .BorderRight.Weight = 5
 .BorderTop.Weight = 5
 .BorderBottom.Weight = 5
 End With
End Sub


Plate.InUse Property (Publisher)

 Copy code hover
[image]

Plate.InUse Property (Publisher)
Send feedback

Returns True if the specified ink (represented by the plate) is used in the publication. Read-only Boolean.

Syntax

expression .InUse

expression A variable that represents an Plate object.

Return Value

Boolean

Remarks

This property corresponds to the In Use or Not In Use notation listed by each ink on the Ink tab of the Color Printing dialog box.

Example

The following example loops through the active publication's plates collection, determines which plates represent inks that are not used in the publication, and deletes them.

Copy code Copy code
Sub DeleteUnusedInks()

Dim intCount As Integer

With ActiveDocument.Plates
 For intCount = .Count To 1 Step -1
 With .Item(intCount)
 If .InUse = False Then
 Debug.Print "Name: " & .Name
 .Delete
 End If
 End With
 Next
End With

End Sub


Field Properties (Publisher)

 Copy code hover
[image]

Field Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Code | Returns a String that represents the text displayed when the page view is set to show field codes. Read-only.
Next | Returns a Field object that represents the next field in a text range.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
PhoneticGuide | Returns a PhoneticGuide object that represents the properties of phonetic text applied to a text range.
Result | Returns a String that represents the result of the specified field. Read-only.
TextRange | Returns a TextRange object that represents the text that is attached to a shape and properties and methods for manipulating the text.
Type | Specifies the field type. Read-only.


AdvancedPrintOptions.ManualFeedDirection Property (Publisher)

 Copy code hover
[image]

AdvancedPrintOptions.ManualFeedDirection Property (Publisher)
See also Send feedback

Gets or sets the orientation (landscape or portrait) of how envelopes are fed to the printer's manual feed. Read/write.

Version Information

Version Added: Publisher 2007

Syntax

expression .ManualFeedDirection

expression A variable that represents an AdvancedPrintOptions object.

Return Value

PbOrientationType

Remarks

The ManualFeedDirection property setting, in conjunction with the AdvancedPrintOptions.ManualFeedAlign property setting, corresponds to the Envelope feed method setting in the Envelope Setup dialog box in the Microsoft Publisher user interface. (On the File menu, click Print Setup. On the Printer Details tab, click Advanced Printer Setup. On the Printer Setup Wizard tab, click Envelope Setup Dialog)

Possible values for ManualFeedDirection are pbOrientationLandscape (2) and pbOrientationPortrait (1).

See also

Concepts

AdvancedPrintOptions Object

Other resources

AdvancedPrintOptions Object Members


PageSetup.PublicationLayout Property (Publisher)

 Copy code hover
[image]

PageSetup.PublicationLayout Property (Publisher)
See also Send feedback

Returns or sets a PbPublicationLayout Enumeration (Publisher) constant that indicates the layout of a publication. Read/write.

Syntax

expression .PublicationLayout

expression A variable that represents a PageSetup object.

Return value

PBPUBLICATIONLAYOUT

Remarks

Using the PublicationLayout property to set the layout of a publication is equivalent to setting the layout from the list box in the Page Setup dialog box.

Example

The following example sets the layout of the active publication to pbLayoutBusinessCardUS, which, by default, specifies a page width of 3.5 inches and a page height of 2 inches.

VBA Copy code Copy code
With ActiveDocument.PageSetup
    .PublicationLayout = pbLayoutBusinessCardUS
End With

See also

Concepts

PageSetup Object (Publisher)

Other resources

PageSetup Members (Publisher)


Section.ShowHeaderFooterOnFirstPage Property (Publisher)

 Copy code hover
[image]

Section.ShowHeaderFooterOnFirstPage Property (Publisher)
Send feedback

True if the header and footer of the specified section will be visible. Read/write Boolean.

Syntax

expression .ShowHeaderFooterOnFirstPage

expression A variable that represents a Section object.

Return Value

Boolean

Example

The following example adds a new section starting on the second page of the active document, adds header and footer text to the master page, and then sets the ShowHeaderFooterOnFirstPage property to True.

VBA Copy code Copy code
Dim objSection As Section
Set objSection = ActiveDocument.Sections.Add(StartPageIndex:=2)
With ActiveDocument.Pages(2).Master
 .Header.TextRange.Text = "Page " & .PageNumber & " header."
 .Footer.TextRange.Text = "Page " & .PageNumber & " footer."
End With
objSection.ShowHeaderFooterOnFirstPage = True


ShapeRange.AddToCatalogMergeArea Method (Publisher)

 Copy code hover
[image]

ShapeRange.AddToCatalogMergeArea Method (Publisher)
Send feedback

Adds the specified shape or shapes to the publication page's catalog merge area.

Syntax

expression .AddToCatalogMergeArea

expression A variable that represents a ShapeRange object.

Remarks

The catalog merge area is automatically resized to accommodate objects that are larger than the merge area, or that are positioned outside the catalog merge area when they are added.

The AddToCatalogMergeArea method does not apply to merge data fields:

  • Use the Insert method of the MailMergeDataFields collection to add a picture data field to a publication page's catalog merge area.

  • Use the InsertMailMergeField method of the TextRange object to add a text data field to a text box.

Note that to add a text box that will contain text data fields to a catalog merge area, you use the AddToCatalogMergeArea method.

Example

The following example adds a rectangle to the catalog merge area on the first page of the specified publication. This example assumes a catalog merge area has been added to the first page.

Copy code Copy code
ThisDocument.Pages(1).Shapes.AddShape(1, 80, 75, 450, 125).AddToCatalogMergeArea


Pages.Count Property (Publisher)

 Copy code hover
[image]

Pages.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a Pages object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


WebNavigationBarHyperlinks.Add Method (Publisher)

 Copy code hover
[image]

WebNavigationBarHyperlinks.Add Method (Publisher)
Send feedback

Adds a new Hyperlink object to the specified WebNavigationBarHyperlinks collection and returns the new Hyperlink object. .

Syntax

expression .Add(Address, RelativePage, PageID, TextToDisplay, Index)

expression A variable that represents a WebNavigationBarHyperlinks object.

Parameters

Name | Required/Optional | Data Type | Description
Address | Optional | String | The address of the new hyperlink. If RelativePage is pbHlinkTargetTypeURL (default) or pbHlinkTargetTypeEmail, Address must be specified or an error occurs.
RelativePage | Optional | PbHlinkTargetType | The type of hyperlink to add.
PageID | Optional | Long | The page ID of the destination page for the new hyperlink. If RelativePage is pbHlinkTargetTypePageID, PageID must be specified or an error occurs. The page ID corresponds to the PageID property of the destination page.
TextToDisplay | Optional | String | The display text of the new hyperlink.
Index | Optional | Long | The index of the new Hyperlink object in the WebNavigationBarHyperlinks collection.

Return Value

Hyperlink

Remarks

RelativePage can be one of these PbHlinkTargetType constants. The default is pbHlinkTargetTypeURL.

pbHlinkTargetTypeEmail

pbHlinkTargetTypeFirstPage

pbHlinkTargetTypeLastPage

pbHlinkTargetTypeNextPage

pbHlinkTargetTypePageID

pbHlinkTargetTypePreviousPage

pbHlinkTargetTypeURL


Shape.Connector Property (Publisher)

 Copy code hover
[image]

Shape.Connector Property (Publisher)
Send feedback

Returns an MsoTriState value indicating whether the specified shape is a connector. Read-only.

Syntax

expression .Connector

expression A variable that represents a Shape object.

Remarks

The Connector property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The shape is not a connector.
msoTriStateMixed | Return value indicating a combination of msoTrue and msoFalse for the specified shape.
msoTrue | The shape is a connector.

Example

This example deletes all connectors on page one of the active publication.

Copy code Copy code
Dim i As Integer

With ActiveDocument.Pages(1).Shapes
 For i = .Count To 1 Step -1
 With .Item(i)
 If .Connector Then .Delete
 End With
 Next
End With


WebListBoxItems Object (Publisher)

 Copy code hover
[image]

WebListBoxItems Object (Publisher)
Send feedback

Represents the items in a Web list box control.

Example

Use the ListBoxItems property to access the items in a Web list box. Use the AddItem method of the WebListBoxItems collection to add items to a Web list box. This example creates a new Web list box and adds several items to it. Note that when initially created, a Web list box control contains three default items. This example includes a routine that deletes the default list box items before adding new items.

Copy code Copy code
Sub CreateWebListBox()
 Dim intCount As Integer
 With ActiveDocument.Pages(1).Shapes
 With .AddWebControl(Type:=pbWebControlListBox, Left:=100, _
 Top:=150, Width:=300, Height:=72).WebListBox
 .MultiSelect = msoFalse
 With .ListBoxItems
 For intCount = 1 To .Count
 .Delete (1)
 Next
 .AddItem Item:="Green"
 .AddItem Item:="Purple"
 .AddItem Item:="Red"
 .AddItem Item:="Black"
 End With
 End With
 End With
End Sub


Document.PrintPageBackgrounds Property (Publisher)

 Copy code hover
[image]

Document.PrintPageBackgrounds Property (Publisher)
Send feedback

Returns or sets True to include page backgrounds when printing pages from the specified publication. Default is True. Read/write Boolean.

Syntax

expression .PrintPageBackgrounds

expression A variable that represents a Document object.

Return Value

Boolean

Remarks

Use the PageBackground object to create, alter, or delete the background of a specified page.

Example

The following example sets page backgrounds to print for the active publication.

VBA Copy code Copy code
ActiveDocument.PrintPageBackgrounds = True


Shape.Flip Method (Publisher)

 Copy code hover
[image]

Shape.Flip Method (Publisher)
Send feedback

Flips the specified shape around its horizontal or vertical axis, or flips all the shapes in the specified shape range around their horizontal or vertical axes.

Syntax

expression .Flip(FlipCmd)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
FlipCmd | Required | MsoFlipCmd | Specifies whether the shape is flipped horizontally or vertically.

Return Value

Nothing

Remarks

The FlipCmd parameter can be one of the following MsoFlipCmd constants declared in the Microsoft Office type library.

msoFlipHorizontal

msoFlipVertical

Example

This example adds a triangle to the first page of the active publication, duplicates the triangle, and then flips the duplicate triangle vertically and makes it red.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes _
 .AddShape(Type:=msoShapeRightTriangle, _
 Left:=10, Top:=10, Width:=50, Height:=50) _
 .Duplicate
 .Fill.ForeColor.RGB = RGB(255, 0, 0)
 .Flip msoFlipVertical
End With


BorderArtFormat Members (Publisher)

 Copy code hover
[image]

BorderArtFormat Members (Publisher)
Send feedback

Represents the formatting of the BorderArt applied to the specified shape.

Methods

Name | Description
Delete | Deletes the specified object.
RevertToDefaultWeight | Sets the BorderArt on the specified shape back to its default thickness.
RevertToOriginalColor | Sets the BorderArt on the specified shape back to its default color.
Set | Sets the type of BorderArt applied to the specified shape.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Color | Returns a ColorFormat object representing the color information for the specified object.
Exists | True if the specified BorderArtFormat object exists. Read-only Boolean.
Name | Returns or sets a String value indicating the name of the specified object. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
StretchPictures | True to stretch the picture art making up the specified BorderArt to fit the shape to which it is applied. Read/write Boolean. .
Weight | Returns or sets a Variant indicating the thickness of the specified line or cell border.


ShapeRange.Application Property (Publisher)

 Copy code hover
[image]

ShapeRange.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a ShapeRange object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


MailMergeFilters.Item Method (Publisher)

 Copy code hover
[image]

MailMergeFilters.Item Method (Publisher)
Send feedback

Returns an individual object in a specified collection.

Syntax

expression .Item(Index)

expression A variable that represents a MailMergeFilters object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The number of the object to return.

Return Value

Object


Font.DiacriticColor Property (Publisher)

 Copy code hover
[image]

Font.DiacriticColor Property (Publisher)
Send feedback

Returns a ColorFormat object representing the 24-bit color used for diacritics in a right-to-left language publication.

Syntax

expression .DiacriticColor

expression A variable that represents a Font object.

Return Value

ColorFormat

Example

This example tests the text in the first story of the current publication to see if its color is red and it is formatted right-to-left.

Copy code Copy code
Sub FontDiColor()

 Dim fntDiColor As Font

 Set fntDiColor = Application.ActiveDocument. _
 Stories(1).TextRange.Font

 If fntDiColor.UseDiacriticColor = msoTrue And _
 fntDiColor.DiacriticColor.RGB = RGB(255, 0, 0) Then
 MsgBox "Your text is red"
 Else
 MsgBox "This is not a right-to-left language" _
 & " or your color is not red"
 End If

End Sub


Attachment Methods (Publisher)

 Copy code hover
[image]

Attachment Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Delete | Deletes an Attachment object from the Attachments collection of an e-mail merge message.


MailMergeFilterCriterion Members (Publisher)

 Copy code hover
[image]

MailMergeFilterCriterion Members (Publisher)
Send feedback

Represents a filter to be applied to an attached mail merge or catalog merge data source. The MailMergeFilterCriterion object is a member of the MailMergeFilters object.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Column | Returns a String that represents the name of the field in the mail merge data source to use in the filter. Read/write.
CompareTo | Returns or sets a String that represents the text to compare in the query filter criterion. Read/write.
Comparison | Returns or sets an MsoFilterComparison constant that represents how to compare the Column and CompareTo properties. Read/write.
Conjunction | Returns or sets an MsoFilterConjunction constant that represents how a filter criterion relates to other filter criteria in the MailMergeFilters object. Read/write.
Creator | Returns a Long that represents the application in which the specified object was created. For example, if the object was created in Microsoft Publisher, this property returns the hexadecimal number 4D505542, which represents the string "MSPB." This value can also be represented by the constant.
Index | Returns a Long that represents the position of a particular item in a specified collection. .
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


MailMergeFilterCriterion.CompareTo Property (Publisher)

 Copy code hover
[image]

MailMergeFilterCriterion.CompareTo Property (Publisher)
Send feedback

Returns or sets a String that represents the text to compare in the query filter criterion. Read/write.

Syntax

expression .CompareTo

expression A variable that represents a MailMergeFilterCriterion object.

Return Value

String

Example

The following example changes an existing filter to remove from the mail merge all records that do not have a Region field equal to "WA". This example assumes that a mail merge data source is attached to the active publication.

Copy code Copy code
Sub SetQueryCriterion()
 Dim intItem As Integer
 With ActiveDocument.MailMerge.DataSource.Filters
 For intItem = 1 To .Count
 With .Item(intItem)
 If .Column = "Region" Then
 .Comparison = msoFilterComparisonNotEqual
 .CompareTo = "WA"
 If .Conjunction = "Or" Then .Conjunction = "And"
 End If
 End With
 Next intItem
 End With
End Sub


Document.ViewBoundaries Property (Publisher)

 Copy code hover
[image]

Document.ViewBoundaries Property (Publisher)
Send feedback

Returns True if object boundaries are visible in the specified publication. Read/write Boolean.

Syntax

expression .ViewBoundaries

expression A variable that represents a Document object.

Return Value

Boolean


Window Properties (Publisher)

 Copy code hover
[image]

Window Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Caption | Returns or sets a String indicating the caption at the top of the Microsoft Publisher application window. Read/write.
Height | Returns or sets a Long that represents the height (in points) of the window. Read/write.
Hwnd | Returns a Long indicating the handle to the Microsoft Publisher application window. Read-only.
Left | Returns or sets a Long indicating the position (in points) of the left edge of the application window relative to the left edge of the screen. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Top | Returns or sets a Long that represents the distance between the top edge of the screen and the application window. Read/write.
Visible | True if the window is visible. Read/write Boolean.
Width | Returns or sets a Long that represents the width (in points) of the window. Read/write.
WindowState | Returns or sets a PbWindowState constant indicating the state of the Microsoft Publisher window. Read/write.


MailMergeFilters.Count Property (Publisher)

 Copy code hover
[image]

MailMergeFilters.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a MailMergeFilters object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


Application.CentimetersToPoints Method (Publisher)

 Copy code hover
[image]

Application.CentimetersToPoints Method (Publisher)
See also Send feedback

Converts a measurement from centimeters to points (1 cm = 28.35 points). Returns the converted measurement as a Single.

Syntax

expression .CentimetersToPoints(Value)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Value | Required | Single | The centimeter value to be converted to points.

Return Value

Single

Remarks

Use the PointsToCentimeters method to convert measurements in points to centimeters.

Example

This example converts measurements in centimeters entered by the user to measurements in points.

Copy code Copy code
Dim strInput As String
Dim strOutput As String

Do While True
 ' Get input from user.
 strInput = InputBox( _
 Prompt:="Enter measurement in centimeters (0 to cancel): ", _
 Default:="0")

 ' Exit the loop if user enters zero.
 If Val(strInput) = 0 Then Exit Do

 ' Evaluate and display result.
 strOutput = Trim(strInput) & " cm = " _
 & Format(Application _
 .CentimetersToPoints(Value:=Val(strInput)), _
 "0.00") & " points"

 MsgBox strOutput
Loop

See also

Concepts

Application Object

Other resources

Application Object Members


PbCalendarType Enumeration (Publisher)

 Copy code hover
[image]

PbCalendarType Enumeration (Publisher)
Send feedback

The calendar type to use when displaying the date or time.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbCalendarTypeArabicHijri | 1 | Arabic Hijri calendar
pbCalendarTypeChineseNational | 3 | Chinese National calendar
pbCalendarTypeHebrewLunar | 2 | Hebrew Lunar calendar
pbCalendarTypeJapaneseEmperor | 4 | Japanese Emperor calendar
pbCalendarTypeKoreanDanki | 6 | Korean Danki calendar
pbCalendarTypeSakaEra | 7 | Saka Era calendar
pbCalendarTypeThaiBuddhist | 5 | Thai Buddhist calendar
pbCalendarTypeTranslitEnglish | 8 | English calendar
pbCalendarTypeTranslitFrench | 9 | French calendar
pbCalendarTypeWestern | 0 | Western calendar


Shape.HasTable Property (Publisher)

 Copy code hover
[image]

Shape.HasTable Property (Publisher)
Send feedback

Returns msoTrue if the shape represents a TableFrame object or msoFalse if the shape represents any other object type. Read-only.

Syntax

expression .HasTable

expression A variable that represents a Shape object.

Remarks

The HasTable property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The shapes in the range do not represent a TableFrame object.
msoTriStateMixed | Indicates a combination of msoTrue and msoFalse for the specified shape range.
msoTrue | The shapes in the range represent a TableFrame object.

Example

This example checks the currently selected shape to see if it is a table. If it is, the code sets the width of column one to one inch (72 points).

VBA Copy code Copy code
Sub IsTable()

 With Application.Selection.ShapeRange
 If .HasTable = msoTrue Then
 .Table.Columns(1).Width = 72
 End If
 End With

End Sub


LayoutGuides Properties (Publisher)

 Copy code hover
[image]

LayoutGuides Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
ColumnGutterWidth | Returns or sets the width of the column gutters that are used by the LayoutGuides object to aid in the process of laying out design elements. Read/write Single.
Columns | Returns or sets a Long that represents the number of guide columns on a page or the number of columns in a text frame. Read/write.
GutterCenterlines | Returns or sets a value that specifies whether to add a center line between the columns and rows of the gutter guides in a master page. Read/write Boolean.
HorizontalBaseLineOffset | Returns a Single that represents the horizontal baseline offset of the specified LayoutGuides object. Read/Write.
HorizontalBaseLineSpacing | Returns a Single that represents the horizontal baseline spacing of the specified LayoutGuides object. Read/write.
MarginBottom | Returns or sets a Variant that represents the amount of space (in points) between the text and the bottom edge of a cell, text frame, or page. Read/write.
MarginLeft | Returns or sets a Variant that represents the amount of space (in points) between the text and the left edge of a cell, text frame, or page. Read/write.
MarginRight | Returns or sets a Variant that represents the amount of space (in points) between the text and the right edge of a cell, text frame, or page. Read/write.
MarginTop | Returns or sets a Variant that represents the amount of space (in points) between the text and the top edge of a cell, text frame, or page. Read/write.
MirrorGuides | Returns or sets a Boolean indicating whether Microsoft Publisher creates mirror guide positions for a book fold publication. True if Publisher creates mirror guide positions for separate left and right pages in a book fold publication; False if the same margin, row, and column guides are applied to all pages in the publication. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
RowGutterWidth | Returns or sets the width of the row gutters that are used by the LayoutGuides object to aid in the process of laying out design elements. Read/write Single.
Rows | Sets or returns a Long that represents the number of rows in a layout guide. Read/write.
VerticalBaseLineOffset | Returns a Single that represents the vertical baseline offset of the specified LayoutGuides object. Read/write.
VerticalBaseLineSpacing | Returns a Single that represents the vertical baseline spacing of the specified LayoutGuides object. Read/write.


PbShapeType Enumeration (Publisher)

 Copy code hover
[image]

PbShapeType Enumeration (Publisher)
Send feedback

Represents the shape type.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbAutoShape | 1 | AutoShape
pbCallout | 2 | Callout
pbCatalogMergeArea | 111 | Catalog Merge Area
pbChart | 3 | Chart
pbComment | 4 | Comment
pbEmbeddedOLEObject | 7 | Embedded OLE Object
pbFormControl | 8 | Form Control
pbFreeform | 5 | Freeform
pbGroup | 6 | Group
pbGroupWizard | 108 | Group Wizard
pbLine | 9 | Line
pbLinkedOLEObject | 10 | Linked OLE Object
pbLinkedPicture | 11 | Picture
pbMedia | 16 | Media
pbOLEControlObject | 12 | OLE Control Object
pbPicture | 13 | Picture
pbPlaceholder | 14 | Placeholder
pbShapeTypeMixed | -2 | Shape Type Mixed
pbTable | 18 | Table
pbTextEffect | 15 | Text effect
pbTextFrame | 17 | Text frame
pbWebCheckBox | 100 | Web check box
pbWebCommandButton | 101 | Web command button
pbWebHotSpot | 110 | Web hot spot
pbWebHTMLFragment | 107 | Web HTML Fragment
pbWebListBox | 102 | Web list box
pbWebMultiLineTextBox | 103 | Web multiLine text box
pbWebNavigationBar | 112 | Web navigation bar
pbWebOptionButton | 104 | Web option button
pbWebSingleLineTextBox | 105 | Web single-line textbox
pbWebWebComponent | 106 | Web Web component


MailMergeDataField.Name Property (Publisher)

 Copy code hover
[image]

MailMergeDataField.Name Property (Publisher)
Send feedback

Returns a String value indicating the name of the specified object. Read-only.

Syntax

expression .Name

expression A variable that represents a MailMergeDataField object.

Remarks

You can use an object's name in conjunction with the Item method or Item property to return a reference to the object if the Item method or property for the collection that contains the object takes a Variant argument. For example, if the value of the Name property for a shape is Rectangle 2, then .Shapes("Rectangle 2") will return a reference to that shape.

The Name property is the default property for the BorderArt, BorderArtFormat, and Label objects.


LayoutGuides.GutterCenterlines Property (Publisher)

 Copy code hover
[image]

LayoutGuides.GutterCenterlines Property (Publisher)
Send feedback

Returns or sets a value that specifies whether to add a center line between the columns and rows of the gutter guides in a master page. Read/write Boolean.

Syntax

expression .GutterCenterlines

expression A variable that represents a LayoutGuides object.

Return Value

Boolean

Remarks

The GutterCenterlines property can only be used if the LayoutGuides.Rows property or the LayoutGuides.Columns property is greater than 1.

If True, a red line appears in the center of the gutter guides. If False, no line appears in the center of the gutter guides. The default value is False.

Example

The following example modifies the first master page of the active publication to have three rows, three columns, and red center lines drawn in the gutter guides. Any pages added to the publication after this point will have red center lines drawn in the gutter guides.

Copy code Copy code
Dim theMasterPage As page
Dim theLayoutGuides As LayoutGuides

Set theMasterPage = ActiveDocument.MasterPages(1)
Set theLayoutGuides = theMasterPage.LayoutGuides

With theLayoutGuides
 .Rows = 3
 .Columns = 3
 .GutterCenterlines = True
End With


Shape Members (Publisher)

 Copy code hover
[image]

Shape Members (Publisher)
Send feedback

Represents an object in the drawing layer, such as an AutoShape, freeform, OLE object, ActiveX control, or picture. The Shape object is a member of the Shapes collection, which includes all the shapes on a page or in a selection.

Methods

Name | Description
AddToCatalogMergeArea | Adds the specified shape or shapes to the publication page's catalog merge area.
Apply | Applies formatting copied from another shape or shape range using the PickUp method.
Copy | Copies the specified object to the Clipboard.
Cut | Deletes the specified object and places it on the Clipboard.
Delete | Deletes the specified object.
Duplicate | Creates a duplicate of the specified Shape or ShapeRange object, adds the new shape or range of shapes to the Shapes collection immediately after the shape or range of shapes specified originally, and then returns the new Shape or ShapeRange object.
Flip | Flips the specified shape around its horizontal or vertical axis, or flips all the shapes in the specified shape range around their horizontal or vertical axes.
GetHeight | Returns the height of the shape or shape range as a Single in the specified units.
GetLeft | Returns the distance of the shape's or shape range's left edge from the left edge of the leftmost page in the current view as a Single in the specified units.
GetTop | Returns the distance of the shape's or shape range's top edge from the top edge of the leftmost page in the current view as a Single in the specified units.
GetWidth | Returns the width of the shape or shape range as a Single in the specified units.
IncrementLeft | Moves the specified shape or shape range horizontally by the specified distance.
IncrementRotation | Changes the rotation of the specified shape around the z-axis (extends outward from the plane of the publication) by the specified number of degrees.
IncrementTop | Moves the specified shape or shape range vertically by the specified distance.
MoveIntoTextFlow | Moves a given shape into the text flow defined by TextRange Object. The shape will always be inserted inline at the beginning of the text flow.
MoveOutOfTextFlow | Moves a given inline shape out of its containing text range, defined by TextRange Object, and makes the shape fixed.
MoveToPage | Moves a shape to the specified page.
PickUp | Copies formatting from a shape or shape range so that it can be copied to another shape or shape range using the Apply method.
RemoveCatalogMergeArea | Deletes the catalog merge area from the specified publication page. All shapes contained in the catalog merge area remain in place on the page, but are no longer connected to the catalog merge data source.
RemoveFromCatalogMergeArea | Removes a shape from the specified page's catalog merge area. Removed shapes are not deleted, but instead remain in place on the page containing the catalog merge area.
RerouteConnections | Reroutes connectors so that they take the shortest possible path between the shapes they connect. To do this, the RerouteConnections method may detach the ends of a connector and reattach them to different connecting sites on the connected shapes.
SaveAsBuildingBlock | Saves a single shape as a building block. Returns the resulting BuildingBlock object.
SaveAsPicture | Saves a single shape as a picture file.
ScaleHeight | Scales the height of the shape by a specified factor. For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original size or relative to the current size.
ScaleWidth | Scales the width of the shape by a specified factor. For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original size or relative to the current size.
Select | Selects the specified object.
SetCaption |
SetShapesDefaultProperties | Applies the formatting for the specified shape or shape range to the default shape. Shapes created after this method has been used will have this formatting applied to them by default.
Ungroup | Ungroups the specified group of shapes or any groups of shapes in the specified shape range. If the specified shape is a picture or OLE object, Microsoft Publisher will break it apart and convert it to an ungrouped set of shapes. (For example, an embedded Microsoft Office Excel spreadsheet is converted into lines and text boxes.) Returns the ungrouped shapes as a single ShapeRange object.
ZOrder | Moves the specified shape in front of or behind other shapes in the collection (that is, changes the shape's position in the z-order).

Properties

Name | Description
Adjustments | Returns an Adjustments collection representing all adjustment handles for the specified Shape or ShapeRange object.
AlternativeText | Returns or sets a String representing the text displayed by a Web browser in place of the Shape object while the Shape object is being downloaded or when graphics are turned off. Read/write.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
AutoShapeType | Returns or sets an MsoAutoShapeType constant that specifies a Shape object's AutoShape type.
BlackWhiteMode | Returns or sets an MsoBlackWhiteMode constant indicating how the specified shape or shape range appears when the publication is viewed in black-and-white mode. Read/write.
BorderArt | Returns a BorderArtFormat object that represents the BorderArt type applied to the specified shape. Returns "Permission Denied" if BorderArt has not been applied to the shape. Read-only.
Callout | Returns a CalloutFormat object representing the formatting of a line callout.
CatalogMergeItems | Returns a CatalogMergeShapes collection that represents the shapes included in the catalog merge area. Read-only.
ConnectionSiteCount | Returns a Long indicating the count of connection sites on the current Shape object. Read-only.
Connector | Returns an MsoTriState value indicating whether the specified shape is a connector. Read-only.
ConnectorFormat | Returns a ConnectorFormat object that contains connector formatting properties. Applies to Shape or ShapeRange objects that represent connectors. Read-only.
Fill | Returns a FillFormat object representing the fill for the specified shape or table cell.
Glow | Returns a GlowFormat object that represents the glow formatting for a shape. Read-only.
GroupItems | Returns a GroupShapes collection if the specified shape is a group.
HasTable | Returns msoTrue if the shape represents a TableFrame object or msoFalse if the shape represents any other object type. Read-only.
HasTextFrame | Returns an MsoTriState constant if the specified shape has a TextFrame object associated with it. Read-only.
Height | Returns or sets a Variant that represents the height (in points) of a specified table row or shape. Read/write.
HorizontalFlip | Indicates whether the specified shape has been flipped around its horizontal axis. Read-only.
Hyperlink | Returns a Hyperlink object representing the hyperlink associated with the specified shape.
ID | Returns a Long that represents the type of a shape, range of shapes, or property, type, or value of a wizard. Read-only.
InlineAlignment | Returns or sets a PbInlineAlignment constant that indicates whether an inline shape has left, right, or in-text alignment. Read/write.
InlineTextRange | Returns a TextRange object that reflects the position of the inline shape in its containing text range. Read-only.
IsExcess | Indicates whether the parent Shape object is an excess shape after the document template (wizard) is changed by using the Document.ChangeDocument method or by using the Change Template command in the user interface. Microsoft Publisher places any excess shape under Extra Content in the Format Publication task pane. Read-only.
IsGroupMember | Returns True if the specified shape is a member of a group, False otherwise. Read-only Boolean.
IsInline | Returns an MsoTriState constant that specifies whether a shape is inline (contained in a text run). Read-only.
Left | Returns or sets a Variant indicating the distance from the left edge of the page to the leftmost edge of the specified shape. Numeric values are in points; all other values are in any measurement supported by Publisher (for example, "2.5 in"). Read/write.
Line | Returns a LineFormat object that contains line formatting properties for the specified shape. (For a line, the LineFormat object represents the line itself; for a shape with a border, the LineFormat object represents the border.).
LinkFormat | Returns a LinkFormat object that contains the properties that are unique to linked OLE objects. Read-only.
LockAspectRatio | Returns or sets an MsoTriState constant indicating whether the specified shape retains its original proportions when you resize it. Read/write.
Name | Returns or sets a String value indicating the name of the specified object. Read/write.
Nodes | Returns a ShapeNodes collection that represents the geometric description of the specified shape. Applies to Shape or ShapeRange objects that represent freeform drawings.
OLEFormat | Returns an OLEFormat object that contains OLE formatting properties for the specified shape. Applies to Shape or ShapeRange objects that represent OLE objects.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
ParentGroupShape | Returns a Shape object that represents the common parent shape of a child shape or a range of child shapes.
PictureFormat | Returns a PictureFormat object that contains picture formatting properties for the specified object. Applies to Shape or ShapeRange objects that represent pictures or OLE objects. Read-only.
Reflection | Returns a ReflectionFormat object that represents the reflection formatting for a shape. Read-only.
Rotation | Returns or sets a Single that represents the number of degrees the specified shape is rotated around the z-axis. A positive value indicates clockwise rotation; a negative value indicates counterclockwise rotation. Read/write.
Shadow | Returns a ShadowFormat object that represents the shadow formatting for the specified shape.
SoftEdge | Returns a SoftEdgeFormat object that represents the soft edge formatting for a shape. Read-only.
Table | Returns a Table object that represents a table in Microsoft Publisher.
Tags | Returns a Tags collection representing tags or custom properties applied to a shape, shape range, page, or publication.
TextEffect | Returns a TextEffectFormat object that represents the text formatting properties of a WordArt object.
TextFrame | Returns a TextFrame object that represents the text in a shape and the properties that control the margins and orientation of the text.
TextWrap | Returns a WrapFormat object that represents the properties for wrapping text around a shape or shape range.
ThreeD | Returns a ThreeDFormat object.
Top | Returns or sets a Variant that represents the distance between the top of the page and the top of a shape. Read/write.
Type | Specifies the shape type. Read-only.
VerticalFlip | Returns msoTrue if the specified shape has been flipped around its vertical axis. Read-only.
Vertices | Returns the coordinates of the specified freeform drawing's vertices (and control points for Bézier curves) as a series of coordinate pairs. Read-only Variant.
WebCheckBox | Returns the WebCheckBox object associated with the specified shape.
WebCommandButton | Returns the WebCommandButton object associated with the specified shape.
WebListBox | Returns the WebListBox object associated with the specified shape.
WebNavigationBarSetName | Returns a String that represents the name of the Web navigation bar set the specified shape is an instance of. Read-only.
WebOptionButton | Returns the WebOptionButton object associated with the specified shape.
WebTextBox | Returns the WebTextBox object associated with the specified shape.
Width | Returns or sets a Variant that represents the width (in points) of a specified table column or shape. Read/write.
Wizard | Returns a Wizard object representing the publication design associated with the specified publication or the wizard associated with the specified Design Gallery object.
WizardTag | Returns or sets a PbWizardTag constant indicating the function of a specified shape with respect to its publication design. Read/write.
WizardTagInstance | Returns or sets a Long indicating the instance of the specified shape compared with other shapes having the same wizard tag. Read/write.
ZOrderPosition | Returns a Long indicating the position of the specified shape or shape range in the z-order. Read-only.


Page.Delete Method (Publisher)

 Copy code hover
[image]

Page.Delete Method (Publisher)
Send feedback

Deletes the specified object.

Syntax

expression .Delete

expression A variable that represents a Page object.

Remarks

A run-time error occurs if the specified object does not exist.


Plate.Index Property (Publisher)

 Copy code hover
[image]

Plate.Index Property (Publisher)
Send feedback

Returns a Long that represents the position of a particular item in a specified collection. .

Syntax

expression .Index

expression A variable that represents a Plate object.

Example

The following example loops through the MailMergeDataFields collection and displays the Index and Name properties for each field.

Copy code Copy code
Dim mmfLoop As MailMergeDataField

With ActiveDocument.MailMerge.DataSource
 If .DataFields.Count > 0 Then
 For Each mmfLoop In .DataFields
 Debug.Print "Field " & mmfLoop.Name _
 & " / Index " & mmfLoop.Index
 Next mmfLoop
 Else
 Debug.Print "No fields to report."
 End If
End With

The following example loops through the Plates collection and displays the Index and Name properties for each plate.

VBA Copy code Copy code
Dim plaLoop As Plate

If ActiveDocument.Plates.Count > 0 Then
 For Each plaLoop In ActiveDocument.Plates
 Debug.Print "Plate " & plaLoop.Name _
 & " / Index " & plaLoop.Index
 Next plaLoop
Else
 Debug.Print "No plates to report."
End If


Font.Reset Method (Publisher)

 Copy code hover
[image]

Font.Reset Method (Publisher)
Send feedback

Removes manual paragraph or text formatting from the specified object and leaves only the formatting specified by the current text style.

Syntax

expression .Reset

expression A variable that represents a Font object.

Return Value

Nothing

Example

The following example resets the character formatting of the text in shape one on page one of the active publication to the default character formatting for the current text style.

Copy code Copy code
ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.Font.Reset

The following example resets the paragraph formatting of the text in shape one on page one of the active publication to the default paragraph formatting for the current text style.

Copy code Copy code
ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.ParagraphFormat.Reset


Fields.Unlink Method (Publisher)

 Copy code hover
[image]

Fields.Unlink Method (Publisher)
Send feedback

Replaces the specified field or Fields collection with with their most recent results.

Syntax

expression .Unlink

expression A variable that represents a Fields object.

Return Value

Nothing

Remarks

When you unlink a field, its current result is converted to text or a graphic and can no longer be updated automatically.

Example

This example unlinks the first field in shape one on the first page of the active publication.

Copy code Copy code
ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.Fields(1).Unlink


Page.PageID Property (Publisher)

 Copy code hover
[image]

Page.PageID Property (Publisher)
Send feedback

Returns a Long indicating the unique identifier for a page in a publication. Read-only.

Syntax

expression .PageID

expression A variable that represents a Page object.

Remarks

PageID values are random numbers assigned to pages when they are added. These unique numbers do not change when pages are added or deleted. Also, these numbers do not start with 1, nor are they contiguous.

Example

The following example displays the PageIndex, PageNumber, and PageID properties for all the pages in the active publication.

VBA Copy code Copy code
Dim lngLoop As Long

With ActiveDocument.Pages
 For lngLoop = 1 To .Count
 With .Item(lngLoop)
 Debug.Print "PageIndex = " & .PageIndex _
 & " / PageNumber = " & .PageNumber _
 & " / PageID = " & .PageID
 End With
 Next lngLoop
End With


MailMergeDataSource Members (Publisher)

 Copy code hover
[image]

MailMergeDataSource Members (Publisher)
Send feedback

Represents the data source in a mail merge or catalog merge operation.

Methods

Name | Description
ApplyFilter | Applies a filter to a mail merge data source to remove (or filter out) specified records containing (or not containing) specific data.
Close | Closes the specified mail merge data source, cancels the mail merge, and converts all mail merge data fields to plain text.
EditRecord | Changes one of the data fields in one of the records in the master data source (the combined mail-merge recipient list).
FindRecord | Searches the contents of the specified mail merge data source for text in a particular field. Returns a Boolean indicating whether the search text is found; True if the search text is found.
OpenRecipientsDialog | Displays the Recipients dialog box for a mail merge publication.
SetAllErrorFlags | Marks all records in a mail merge data source as containing invalid data in an address field.
SetAllIncludedFlags | True to include all data source records in a mail merge.
SetSortOrder | Sets the sort order for mail merge data.

Properties

Name | Description
ActiveRecord | Returns or sets a Long that represents the active mail merge record. Read/write.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
ConnectString | Returns a String that represents the connection to the specified mail merge data source. Read-only.
DataFields | Returns a MailMergeDataFields collection that represents the fields in the specified data source.
DataSources | Returns the MailMergeDataSources collection that includes the parent MailMergeDataSource object. Read-only.
EverValidated | Indicates whether the list of recipient addresses in the parent MailMergeDataSource object has ever been validated. Read/write.
Filters | Returns a MailMergeFilters object that represents filters applied to the mail merge or catalog merge data source.
FirstRecord | Returns or sets a Long that represents the number of the first record to be merged in a mail merge or catalog merge operation. Read/write.
Included | True if a record is included in a mail merge. Read/write Boolean.
InvalidAddress | True to mark a record in a mail merge data source if it contains invalid data. Read/write Boolean.
InvalidComments | If the InvalidAddress property is True, this property returns or sets a String that describes invalid data in a mail merge record. Read/write.
IsMaster | Indicates whether the parent MailMergeDataSource object is a master data source (a combination of all data sources connected to the current publication). Read-only.
LastRecord | Returns or sets a Long that represents the number of the last record to be merged in a mail merge or catalog merge operation. Read/write.
MappedDataFields | Returns a MailMergeMappedDataFields object that represents the mapped data fields available in Microsoft Publisher.
Name | Returns a String value indicating the name of the specified object. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
RecordCount | Returns a Long that represents the number of records in the data source. Read-only.
TableName | Returns a String that represents the name of the table within the data source file that contains the mail merge records. The returned value may be blank if the table name is unknown or not applicable to the current data source. Read-only.
Type | Returns a Long that represents the type of mail merge or catalog merge data source. Read-only.
ValidatedClean | Indicates whether all recipient addresses in the the parent MailMergeDataSource object were successfully validated, and whether any changes are made to the list since the last validation that require the list to be validated again. Read/write.


Page.Height Property (Publisher)

 Copy code hover
[image]

Page.Height Property (Publisher)
Send feedback

Returns a Long that represent the height (in points) of a cell, range of cells, or page. Read-only.

Syntax

expression .Height

expression A variable that represents a Page object.

Remarks

The valid range for the Height property depends on the size of the application workspace and the position of the object within the workspace. For centered objects on non-banner page sizes, the Height property may be 0.0 to 50.0 inches. For centered objects on banner page sizes, the Height property may be 0.0 to 241.0 inches.


PrintableRect.Left Property (Publisher)

 Copy code hover
[image]

PrintableRect.Left Property (Publisher)
Send feedback

Returns a Single indicating the distance (in points) from the left edge of the printer sheet to the left edge of the printable rectangle. Read-only.

Syntax

expression .Left

expression A variable that represents a PrintableRect object.


TabStop.Parent Property (Publisher)

 Copy code hover
[image]

TabStop.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a TabStop object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Options.UseCatalogAtStartup Property (Publisher)

 Copy code hover
[image]

Options.UseCatalogAtStartup Property (Publisher)
Send feedback

True for Microsoft Publisher to show the catalog when starting. Read/write Boolean.

Syntax

expression .UseCatalogAtStartup

expression A variable that represents an Options object.

Return Value

Boolean

Example

This example sets global options for Publisher, including not displaying the catalog upon startup.

VBA Copy code Copy code
Sub SetGlobalOptions()
 With Options
 .AutoFormatWord = True
 .AutoKeyboardSwitching = True
 .AutoSelectWord = True
 .DragAndDropText = True
 .UseCatalogAtStartup = False
 .UseHelpfulMousePointers = False
 End With
End Sub


FillFormat.TwoColorGradient Method (Publisher)

 Copy code hover
[image]

FillFormat.TwoColorGradient Method (Publisher)
Send feedback

Sets the specified fill to a two-color gradient. The two fill colors are specified by the ForeColor and BackColor properties.

Syntax

expression .TwoColorGradient(Style, Variant)

expression A variable that represents a FillFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | MsoGradientStyle | The gradient style.
Variant | Required | Long | The gradient variant. Can be a value from 1 to 4, corresponding to the four variants on the Gradient tab in the Fill Effects dialog box. If Style is msoGradientFromTitle or msoGradientFromCenter, this argument can be either 1 or 2.

Remarks

The Style parameter can be one of the MsoGradientStyle constants declared in the Microsoft Office type library and shown in the following table.

msoGradientDiagonalDown

msoGradientDiagonalUp

msoGradientFromCenter

msoGradientFromCorner

msoGradientFromTitle

msoGradientHorizontal

msoGradientVertical

Example

This example adds a rectangle with a two-color gradient fill to the active publication and sets the background and foreground color for the fill.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes _
 .AddShape(Type:=msoShapeRectangle, _
 Left:=0, Top:=0, Width:=40, Height:=80).Fill
 .ForeColor.RGB = RGB(128, 0, 0)
 .BackColor.RGB = RGB(0, 170, 170)
 .TwoColorGradient Style:=msoGradientHorizontal, Variant:=1
End With


TextEffectFormat Properties (Publisher)

 Copy code hover
[image]

TextEffectFormat Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Alignment | Returns or sets a MsoTextEffectAlignment constant that represents the alignment for the specified text effect. Read/write.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
FontBold | Sets or returns an MsoTriState constant that represents whether the font for a dropped capital letter or WordArt text effect is bold. Read/write.
FontItalic | Sets or returns an MsoTriState constant that represents whether the font for a dropped capital letter or WordArt text effect is italic. Read/write.
FontName | Sets or returns a String that represents the name of the font applied to a dropped capital letter or WordArt text effect. Read/write.
FontSize | Returns or sets a Variant that represents the font size for the specified WordArt, in points. Read/write.
KernedPairs | Sets or returns an MsoTriState constant that indicates whether character pairs in a WordArt object have been kerned. Read/write.
NormalizedHeight | Specifies whether all characters (both uppercase and lowercase) in the specified WordArt are the same height. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
PresetShape | Returns or sets an MsoPresetTextEffectShape constant that represents the shape of the specified WordArt. Read/write.
PresetTextEffect | Returns or sets an MsoPresetTextEffect constant that represents the style of the specified WordArt. The values for this property correspond to the formats in the WordArt Gallery dialog box, numbered from left to right, top to bottom. Read/write.
PresetWordArt | A pbPresetWordArt constant that indicates the type of preset WordArt associated with the specified object. Read/write.
RotatedChars | msoTrue if characters in the specified WordArt are rotated 90 degrees relative to the WordArt's bounding shape. msoFalse if characters in the specified WordArt retain their original orientation relative to the bounding shape. Read/write.
Text | Returns or sets a String that represents the text in a text range or WordArt shape. Read/write.
Tracking | Returns or sets a Variant indicating the tracking value used to display space between the characters in the specified text range. Read/write.


MailMergeDataSource.Filters Property (Publisher)

 Copy code hover
[image]

MailMergeDataSource.Filters Property (Publisher)
Send feedback

Returns a MailMergeFilters object that represents filters applied to the mail merge or catalog merge data source.

Syntax

expression .Filters

expression A variable that represents a MailMergeDataSource object.

Return Value

MailMergeFilters

Example

This example adds a new filter that removes all records with a blank Region field and then applies the filter to the active publication. This example assumes that a mail merge data source is attached to the active publication.

Copy code Copy code
Sub FilterDataSource()
 With ActiveDocument.MailMerge.DataSource
 .Filters.Add Column:="Region", _
 Comparison:=msoFilterComparisonIsBlank, _
 Conjunction:=msoFilterConjunctionAnd
 .ApplyFilter
 End With
End Sub


FillFormat.Type Property (Publisher)

 Copy code hover
[image]

FillFormat.Type Property (Publisher)
Send feedback

Returns an MsoFillType constant that represents the fill format type of a shape. Read-only.

Syntax

expression .Type

expression A variable that represents a FillFormat object.

Remarks

The Type property value can be one of these MsoFillType constants.

msoFillBackground

msoFillGradient

msoFillMixed

msoFillPatterned

msoFillPicture

msoFillSolid

msoFillTextured


WebNavigationBarSet Properties (Publisher)

 Copy code hover
[image]

WebNavigationBarSet Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
AutoUpdate | True if all pages will be added to the specified Web navigation bar set and that adding new pages will update the navigation bar with a corresponding item. Pages must have the AddHyperlinkToWebNavbar set to True or WebPageOptions.IncludePageOnNewWebNavigationBars property set to True to be added or updated within the specified WebNavigationBarSet. Read/write Boolean.
ButtonStyle | Sets or returns a PbWizardNavBarButtonStyle constant that represents the style of the navigation bar buttons: large, small, or text-only. Read/write.
Design | Sets or returns a PbWizardNavBarDesign constant representing the design of the specified Web navigation bar set. Read/write.
HorizontalAlignment | Sets or returns a PbWizardNavBarAlignment constant that represents the horizontal alignment of the buttons in a Web navigation bar set. Read/write.
HorizontalButtonCount | Sets or returns a Long representing the number of buttons in each row of buttons for a Web navigation bar set. Read/write. Long.
IsHorizontal | True if the specified WebNavigationBarSet has a horizontal orientation. Read-only Boolean.
Links | Returns a WebNavigationBarHyperlinks collection containing all of the hyperlinks in the specified Web navigation bar set. Read/write.
Name | Indicates the name of the specified Web navigation bar set. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
ShowSelected | True if the selected button is highlighted for the specified WebNavigationBarSet object. Read/write Boolean.


PageSize Members (Publisher)

 Copy code hover
[image]

PageSize Members (Publisher)
Send feedback

Represents the page size of the current Microsoft Publisher publication.

Properties

Name | Description
Application | Returns an Application object that represents the creator of the parent PageSize object. Read-only.
HasBackgroundImage | Returns True if the blank page size represented by the parent PageSize object has a background image. Read-only.
HorizontalGap | Returns a Variant that represents the distance between the right edge of one publication page and left edge of the next publication page in the same row in the blank page size represented by the parent PageSize object when multiple pages are printed on one sheet of printer paper. Read-only.
LeftMargin | Specifies the distance between the left edge of the printer sheet and the top edge of the publication page in the blank page size represented by the parent PageSize object. Read-only.
Name | Returns the name of the blank page size represented by the parent PageSize object. Read-only.
PageHeight | Gets or sets the page height of the blank page size represented by the parent PageSize object. Read/write.
PageWidth | Gets or sets the page width of the blank page size represented by the parent PageSize object. Read/write.
Parent | Returns the parent of the PageSize object. Read-only.
TopMargin | Specifies the distance between the top edge of the printer sheet and the top edge of the publication page for the blank page size represented by the parent PageSize object. Read-only.
VerticalGap | Returns a Variant that represents the distance in points between the bottom edge of one publication page and top edge of the publication page immediately below it for the blank page size represented by the parent PageSize object. This property applies only when multiple pages are printed on a single sheet of printer paper. Read-only.


TextFrame.Story Property (Publisher)

 Copy code hover
[image]

TextFrame.Story Property (Publisher)
Send feedback

Returns a Story object that represents the story properties in a text range.

Syntax

expression .Story

expression A variable that represents a TextFrame object.

Example

This example returns the story in the selected text range and, if it is in a text frame, inserts text into the text range.

Copy code Copy code
Sub AddTextToStory()
 With Selection.TextRange.Story
 If .HasTextFrame Then
 .TextRange.InsertAfter NewText:=vbLf & "This is a test."
 End If
 End With
End Sub


ShapeRange.TextEffect Property (Publisher)

 Copy code hover
[image]

ShapeRange.TextEffect Property (Publisher)
Send feedback

Returns a TextEffectFormat object that represents the text formatting properties of a WordArt object.

Syntax

expression .TextEffect

expression A variable that represents a ShapeRange object.

Example

This example adds a WordArt object to the active publication and formats and inserts additional into it.

Copy code Copy code
Sub AddFormatNewWordArt()
 With ActiveDocument.Pages(1).Shapes.AddTextEffect( _
 PresetTextEffect:=msoTextEffect1, Text:="Test", _
 FontName:="Snap ITC", FontSize:=30, FontBold:=msoTrue, _
 FontItalic:=msoFalse, Left:=150, Top:=130)
 .Rotation = 90
 With .TextEffect
 .RotatedChars = msoTrue
 .Text = "This is a " & .Text
 End With
 .Width = 250
 End With
End Sub


TextStyles.Parent Property (Publisher)

 Copy code hover
[image]

TextStyles.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a TextStyles object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


FindReplace.ReplaceWithText Property (Publisher)

 Copy code hover
[image]

FindReplace.ReplaceWithText Property (Publisher)
Send feedback

Sets or retrieves a String representing the replacement text in the specified range or selection. Read/write.

Syntax

expression .ReplaceWithText

expression A variable that represents a FindReplace object.

Return Value

String

Remarks

The default setting of the ReplaceWithText property is an empty String.

If the ReplaceScope property is set to either pbReplaceScopeOne or pbReplaceScopeAll and the ReplaceWithText property is not set, the text found will be replaced with the default empty string, thus removing the text.

Example

The following example replaces all occurrences of the word "hello" with "goodbye" in the active document.

VBA Copy code Copy code
With ActiveDocument.Find
 .Clear
 .FindText = "hello"
 .ReplaceWithText = "goodbye"
 .MatchWholeWord = True
 .ReplaceScope = pbReplaceScopeAll
 .Execute
End With


Plates Properties (Publisher)

 Copy code hover
[image]

Plates Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Item | Returns an individual object from a specified collection. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


PictureFormat.HorizontalScale Property (Publisher)

 Copy code hover
[image]

PictureFormat.HorizontalScale Property (Publisher)
Send feedback

Returns a Long that represents the scaling of the picture along its horizontal axis. The scaling is expressed as a percentage (for example, 200 equals 200 percent scaling). Read-only.

Syntax

expression .HorizontalScale

expression A variable that represents a PictureFormat object.

Return Value

Long

Remarks

The effective resolution of a picture is inversely proportional to the scaling at which the picture is printed. The larger the scaling, the lower the effective resolution. For example, suppose a picture measuring 4 inches by 4 inches was originally scanned at 300 dpi. If that picture is scaled to 2 inches by 2 inches, its effective resolution is 600 dpi.

Use the EffectiveResolution property of the PictureFormat object to determine the resolution at which the picture or OLE object will print in the specified document.

Example

The following example prints selected image properties for each picture in the active publication.

Copy code Copy code
Dim pgLoop As Page
Dim shpLoop As Shape

For Each pgLoop In ActiveDocument.Pages
 For Each shpLoop In pgLoop.Shapes
 If shpLoop.Type = pbPicture Or shpLoop.Type = pbLinkedPicture Then

 With shpLoop.PictureFormat

 If .IsEmpty = msoFalse Then
 Debug.Print "File Name: " & .Filename
 Debug.Print "Resolution in Publication: " & .EffectiveResolution & " dpi"
 Debug.Print "Horizontal Scaling: " & .HorizontalScale & "%"
 Debug.Print "Height in publication: " & .Height & " points"
 Debug.Print "Vertical Scaling: " & .VerticalScale & "%"
 Debug.Print "Width in publication: " & .Width & " points"
 End If

 End With
 End If
 Next shpLoop
Next pgLoop


GlowFormat.Transparency Property (Publisher)

 Copy code hover
[image]

GlowFormat.Transparency Property (Publisher)
See also Send feedback

Returns or sets the degree of transparency for the glow effect as a value between 0.0 (opaque) and 1.0 (clear). Read/write Single.

Version Information

Version Added: Publisher 2013

Syntax

expression .Transparency

expression A variable that represents a GlowFormat object.

Return value

Single

See also

Other resources

GlowFormat Object
GlowFormat Object Members


DropCap Object (Publisher)

 Copy code hover
[image]

DropCap Object (Publisher)
Send feedback

Represents a dropped capital letter at the beginning of a paragraph.

Example

Use the DropCap property to return a DropCap object. The following example sets a dropped capital letter for the first letter of each paragraph in the first shape on the first page of the active publication. This example assumes that the specified shape is a text box and not another type of shape.

Copy code Copy code
Sub ApplyDropCap()
 ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange _
 .DropCap.ApplyCustomDropCap Size:=3, Span:=3, Bold:=True
End Sub


DropCap.Clear Method (Publisher)

 Copy code hover
[image]

DropCap.Clear Method (Publisher)
Send feedback

Removes the dropped capital letter formatting.

Syntax

expression .Clear

expression A variable that represents a DropCap object.

Example

This example removes the dropped capital letter formatting in the specified text frame.

Copy code Copy code
Sub ClearDropCap()
 ActiveDocument.Pages(1).Shapes(1).TextFrame _
 .TextRange.DropCap.Clear
End Sub


FindReplace Properties (Publisher)

 Copy code hover
[image]

FindReplace Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
FindText | Sets or retrieves a String representing the text to find in the specified range or selection. Read/write.
Forward | Sets or retrieves a Boolean representing the direction of the text search. True if the find operation searches forward through the document. False if it searches backward through the document. Read/write.
FoundTextRange | Returns a TextRange object that represents the found text or replaced text of a find operation. Read-only.
MatchAlefHamza | Sets or returns a Boolean representing whether or not a search operation will match alefs and hamzas. Read/write.
MatchCase | Sets or returns a Boolean that represents the case sensitivity of the search operation. Read/write.
MatchDiacritics | Sets or returns a Boolean representing whether or not a search operation will match diacritics. Read/write.
MatchKashida | Sets or returns a Boolean representing whether or not a search operation will match kashidas. Read/write.
MatchWholeWord | Sets or returns a Boolean that represents whether the whole word will be matched in the search operation. Read/write. Boolean.
MatchWidth | Sets or returns a Boolean representing whether or not a search operation will match the character width of the searched text. Read/Write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
ReplaceScope | Specifies how many scope replacements are to be made: one, all, or none. Read/write.
ReplaceWithText | Sets or retrieves a String representing the replacement text in the specified range or selection. Read/write.


WebListBoxItems Properties (Publisher)

 Copy code hover
[image]

WebListBoxItems Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


TextFrame.IncludeContinuedFromPage Property (Publisher)

 Copy code hover
[image]

TextFrame.IncludeContinuedFromPage Property (Publisher)
Send feedback

Determines whether the text "Continued from page pagenumber" appears in a text box when Microsoft Publisher links text boxes. Read/write.

Version Information

Version Added: Publisher 2007

Syntax

expression .IncludeContinuedFromPage

expression A variable that represents a TextFrame object.

Return Value

MsoTriState

Remarks

The IncludeContinuedFromPage property corresponds to the Include "Continued from page..." check box in the Publisher user interface. (With the text box selected, on the Format menu, click Text Box, and then click the Text Box tab.)


FreeformBuilder.Parent Property (Publisher)

 Copy code hover
[image]

FreeformBuilder.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a FreeformBuilder object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Options.DefaultTextFlowDirection Property (Publisher)

 Copy code hover
[image]

Options.DefaultTextFlowDirection Property (Publisher)
Send feedback

Returns or sets a PbDirectionType constant that represents a global Microsoft Publisher option, indicating whether text flows from left to right or from right to left in a publication. Read/write.

Syntax

expression .DefaultTextFlowDirection

expression A variable that represents a Options object.

Return Value

PbDirectionType

Remarks

The DefaultTextFlowDirection property value can be one of the PbDirectionType constants declared in the Publisher type library.

This property generates an error if you are not running a bi-directional-enabled version of Publisher (for example, Arabic).

Example

This example sets the default direction for new publications and text flow in a bi-directional-enabled version of Publisher.

VBA Copy code Copy code
Sub SetDefaultDirection()
 With Options
 .DefaultPubDirection = pbDirectionRightToLeft
 .DefaultTextFlowDirection = pbDirectionRightToLeft
 End With
End Sub


InlineShapes.Item Method (Publisher)

 Copy code hover
[image]

InlineShapes.Item Method (Publisher)
Send feedback

Returns a Shape object that represents an inline shape contained in a text range. This method is the default member of the InlineShapes collection.

Syntax

expression .Item(Index)

expression A variable that represents an InlineShapes object.

Parameters

Name | Required/Optional | Data Type | Description
var | Required | Variant | The index position or name of the object to return. If Index is an integer, the index into the collection is 1-based. If Index is a string, the name of the shape is used as the index. An automation error is returned if the index or name does not represent a shape in the collection.

Return Value

Shape

Example

This example finds the first inline shape in a text range and flips it vertically.

VBA Copy code Copy code
Dim theShape As Shape

Set theShape = ActiveDocument.Pages(1).Shapes(1)

With theShape.TextFrame.Story.TextRange
 With .InlineShapes.Item(1)
 .Flip (msoFlipVertical)
 End With
End With


CalloutFormat Methods (Publisher)

 Copy code hover
[image]

CalloutFormat Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
AutomaticLength | Specifies that the first segment of the callout line (the segment attached to the text callout box) be scaled automatically when the callout is moved.
CustomDrop | Sets the vertical distance from the edge of the text bounding box to the place where the callout line attaches to the text box.
CustomLength | Specifies that the first segment of the callout line (the segment attached to the text callout box) retain a fixed length whenever the callout is moved.
PresetDrop | Specifies whether the callout line attaches to the top, bottom, or center of the callout text box or whether it attaches at a point that is a specified distance from the top or bottom of the text box.


ShapeRange.WizardTagInstance Property (Publisher)

 Copy code hover
[image]

ShapeRange.WizardTagInstance Property (Publisher)
Send feedback

Returns or sets a Long indicating the instance of the specified shape compared with other shapes having the same wizard tag. Read/write.

Syntax

expression .WizardTagInstance

expression A variable that represents a ShapeRange object.

Remarks

The combination of the WizardTagInstance property and the WizardTag property uniquely defines every shape in a publication.

Example

The following example displays the wizard tag and wizard tag instance information for all the shapes on page one of the active publication.

Copy code Copy code
Dim shpLoop As Shape

For Each shpLoop In ActiveDocument.Pages(1).Shapes
 With shpLoop
 Debug.Print "Shape: " & .Name
 Debug.Print " Wizard tag: " & .WizardTag
 Debug.Print " Wizard tag instance: " _
 & .WizardTagInstance
 End With
Next shpLoop


PbImageFormat Enumeration (Publisher)

 Copy code hover
[image]

PbImageFormat Enumeration (Publisher)
Send feedback

Represents the image format of a picture as determined by Microsoft® Windows® Graphics Device Interface (GDI+).

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbImageFormatCMYKJPEG | 10 | CMYKJPEG
pbImageFormatDIB | 7 | DIB
pbImageFormatEMF | 2 | EMF
pbImageFormatGIF | 8 | GIF
pbImageFormatJPEG | 5 | JPEG
pbImageFormatPICT | 4 | PICT
pbImageFormatPNG | 6 | PNG
pbImageFormatTIFF | 9 | TIFF
pbImageFormatUNKNOWN | 1 | Unknown
pbImageFormatWMF | 3 | WMF


WebNavigationBarSet.HorizontalAlignment Property (Publisher)

 Copy code hover
[image]

WebNavigationBarSet.HorizontalAlignment Property (Publisher)
Send feedback

Sets or returns a PbWizardNavBarAlignment constant that represents the horizontal alignment of the buttons in a Web navigation bar set. Read/write.

Syntax

expression .HorizontalAlignment

expression A variable that represents a WebNavigationBarSet object.

Return Value

PbWizardNavBarAlignment

Remarks

This property is used to set the way that buttons are displayed in a horizontally oriented Web navigation bar set. For example, a WebNavigationBarSet object containing 5 links with the HorizontalButtonCount property set to 3 and the HorizontalAlignment property set to pbnbAlignRight will align the buttons in a grid of 3 columns and 1 row. The first 3 buttons will be in the first row and the remaining 2 buttons will be in the rightmost columns of the second row.

Returns "Access denied" if IsHorizontal = False for the specified WebNavigationBarSet object. Use the ChangeOrientation method to set the orientation of the Web navigation bar set to horizontal first before setting the HorizontalAlignment property.

The HorizontalAlignment property value can be set to any of the PbWizardNavBarAlignment constants declared in the Microsoft Publisher type library.

Example

The following example returns the first Web navigation bar set from the active document, changes the orientation to horizontal if necessary, sets the HorizontalButtonCount property to 3, and then sets the HorizontalAlignment property to pbnbAlignRight.

VBA Copy code Copy code
With ActiveDocument.WebNavigationBarSets(1)
 If .IsHorizontal = False Then
 .ChangeOrientation pbNavBarOrientHorizontal
 End If
 .HorizontalButtonCount = 3
 .HorizontalAlignment = pbnbAlignRight
End With


BorderArtFormat.Parent Property (Publisher)

 Copy code hover
[image]

BorderArtFormat.Parent Property (Publisher)
See also Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a BorderArtFormat object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub

See also

Concepts

BorderArtFormat Object

Other resources

BorderArtFormat Object Members


Plates Object (Publisher)

 Copy code hover
[image]

Plates Object (Publisher)
Send feedback

A collection of Plate objects in a publication.

Example

The Plates collection is made up of Plate objects for the various publication color modes. Each publication can only use one color mode. For example, you can't specify the spot-color mode in a procedure and then later specify the process-color mode. Use the CreatePlateCollection method of the Document object to specify which color mode to use in a publication's plate collection. Use the Add method of the Plates collection to add a new plate to the Plates collection. This example creates a new spot-color plate collection and adds a plate to it.

Copy code Copy code
Sub AddNewPlates()
 Dim plts As Plates
 Set plts = ActiveDocument.CreatePlateCollection(Mode:=pbColorModeSpot)
 plts.Add
 With plts(1)
 .Color.RGB = RGB(Red:=255, Green:=0, Blue:=0)
 .Luminance = 4
 End With
End Sub

Use the EnterColorMode method of the Document object to the specify the color mode and the Plates collection to use with the color mode. Use the ColorMode property to determine which color mode is in use in a publication. This example creates a spot-color plate collection, adds two plates to it, and then enters those plates into the spot-color mode.

Copy code Copy code
Sub CreateSpotColorMode()
 Dim plArray As Plates

 With ThisDocument
 'Creates a color plate collection,
 'which contains one black plate by default
 Set plArray = .CreatePlateCollection(Mode:=pbColorModeSpot)

 'Sets the plate color to red
 plArray(1).Color.RGB = RGB(255, 0, 0)

 'Adds another plate, black by default and
 'sets the plate color to green
 plArray.Add
 plArray(2).Color.RGB = RGB(0, 255, 0)

 'Enters spot-color mode with above
 'two plates in the plates array
 .EnterColorMode Mode:=pbColorModeSpot, Plates:=plArray
 End With
End Sub

Use the FindPlateByInkName method to return a specific plate by referencing its ink name. Process colors are assigned different index numbers in the Plates collection than in the PrintablePlates collection. Use the FindPlateByInkName method to insure the desired Plate or PrintablePlate object is accessed.


PhoneticGuide Properties (Publisher)

 Copy code hover
[image]

PhoneticGuide Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Alignment | Returns a PbPhoneticGuideAlignmentType constant that represents the position of phonetic characters above Japanese text. Read-only.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
BaseText | Returns a String that represents the text to which the specified phonetic text applies. Read-only.
FontName | Returns a String that represents the name of the font applied to phonetic information displayed above Japanese text. Read-only.
FontSize | Returns a Variant that represents the font size of phonetic characters. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Raise | Returns a Variant indicating the distance between the top of the base text and the bottom of the guide text. Read-only.
Text | Returns a String that represents the contents of phonetic text. Read-only.


WizardValues.Item Property (Publisher)

 Copy code hover
[image]

WizardValues.Item Property (Publisher)
Send feedback

Returns an individual object from a specified collection. Read-only.

Syntax

expression .Item(Index)

expression A variable that represents a WizardValues object.

Parameters

Name | Required/Optional | Data Type | Description
Item | Required | Long | The number of the object to return.


Stories.Application Property (Publisher)

 Copy code hover
[image]

Stories.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a Stories object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Shape.ScaleWidth Method (Publisher)

 Copy code hover
[image]

Shape.ScaleWidth Method (Publisher)
Send feedback

Scales the width of the shape by a specified factor. For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original size or relative to the current size.

Syntax

expression .ScaleWidth(Factor, RelativeToOriginalSize, fScale)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Factor | Required | Single | Specifies the ratio between the width of the shape after you resize it and the current or original width. For example, to make a rectangle 50 percent larger, specify 1.5 for this argument.
RelativeToOriginalSize | Required | MsoTristate | Specifies whether to scale relative to the object's original or current size.
fScale | Optional | MsoScaleFrom | The part of the shape that retains its position when the shape is scaled.

Remarks

The RelativeToOriginalSize parameter can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | Scales the shape relative to its current size.
msoTrue | Scales the shape relative to its original size.

The fScale parameter can be one of the MsoScaleFrom constants declared in the Microsoft Office type library and shown in the following table. The default is msoScaleFromTopLeft.

msoScaleFromBottomRight

msoScaleFromMiddle

msoScaleFromTopLeft

Shapes other than pictures and OLE objects are always scaled relative to their current width; specifying a RelativeToOriginalSize value of msoTrue for shapes other than pictures or OLE objects causes an error.

Use the ScaleHeight method to scale the height of a shape.

Example

This example scales all pictures and OLE objects on the first page of the active publication to 175 percent of their original height and width, and it scales all other shapes to 175 percent of their current height and width.

VBA Copy code Copy code
' Looping variable.
Dim shpLoop As Shape

' Loop through all the shapes on the first page.
For Each shpLoop In ActiveDocument.Pages(1).Shapes
 With shpLoop
 Select Case .Type
 ' If the shape is a picture or OLE object,
 ' scale relative to original size.
 Case pbPicture, pbLinkedPicture, _
 pbEmbeddedOLEObject, pbLinkedOLEObject, _
 pbOLEControlObject
 .ScaleHeight Factor:=1.75, _
 RelativeToOriginalSize:=True
 .ScaleWidth Factor:=1.75, _
 RelativeToOriginalSize:=True
 ' If the shape is not a picture or OLE object,
 ' scale relative to the current size.
 Case Else
 .ScaleHeight Factor:=1.75, _
 RelativeToOriginalSize:=False
 .ScaleWidth Factor:=1.75, _
 RelativeToOriginalSize:=False
 End Select
 End With
Next shpLoop


Selection.TextRange Property (Publisher)

 Copy code hover
[image]

Selection.TextRange Property (Publisher)
Send feedback

Returns a TextRange object that represents the text that is attached to a shape and properties and methods for manipulating the text.

Syntax

expression .TextRange

expression A variable that represents a Selection object.

Example

The following example adds text to the text frame of shape one in the active publication, and then formats the new text. This example assumes there is at least one shape on the first page of the active publication.

Copy code Copy code
Sub AddTextToTextFrame()
 With ActiveDocument.Pages(1).TextFrame.TextRange
 .Text = "My Text"
 With .Font
 .Bold = msoTrue
 .Size = 25
 .Name = "Arial"
 End With
 End With
End Sub

The following example adds a rectangle to the active publication and adds text to it.

Copy code Copy code
Sub AddTextToShape()
 With ActiveDocument.Pages(1).Shapes.AddShape(Type:=msoShapeRectangle, _
 Left:=72, Top:=72, Width:=250, Height:=140)
 .TextFrame.TextRange.Text = "Here is some test text"
 End With
End Sub


DropCap.FontBold Property (Publisher)

 Copy code hover
[image]

DropCap.FontBold Property (Publisher)
Send feedback

Sets or returns an MsoTriState constant that represents whether the font for a dropped capital letter or WordArt text effect is bold. Read/write.

Syntax

expression .FontBold

expression A variable that represents a DropCap object.

Remarks

The FontBold property value can be one of the MsoTriState constants declared in the Microsoft Office type library.

Example

This example applies bold formatting to the dropped capital letter in the specified text frame. This example assumes that the specified text frame is formatted with a dropped capital letter.

VBA Copy code Copy code
Sub BoldDropCap()
 With ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.DropCap
 .FontBold = msoTrue
 .FontColor.RGB = RGB(Red:=150, Green:=50, Blue:=180)
 .FontItalic = msoTrue
 .FontName = "Script MT Bold"
 End With
End Sub


CellBorder.Application Property (Publisher)

 Copy code hover
[image]

CellBorder.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a CellBorder object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


WebPageOptions Members (Publisher)

 Copy code hover
[image]

WebPageOptions Members (Publisher)
Send feedback

Represents the properties of a single Web page within a Web publication, including options for adding the title and description of the page, background sounds, in addition to other options. The WebPageOptions object is a member of the Page object.

Methods

Name | Description
SetBackgroundSoundRepeat | Specifies whether the background sound attached to a Web page should be played infinitely after the page is loaded in a Web browser, and if it should not, optionally specifies the number of times the background sound should be played.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
BackgroundSound | Returns or sets a String that specifies the path to a sound file that is played when the Web page is loaded in a Web browser. Read/write.
BackgroundSoundLoopCount | Returns a Long value that specifies the number of times the background sound attached to a Web page is played when the page is loaded in a Web browser. Read-only.
BackgroundSoundLoopForever | Returns a Boolean value that specifies whether the background sound attached to the Web page should be repeated infinitely. Read-only.
Description | Returns or sets a String that represents the description of a Web page within a Web publication. Read/write.
IncludePageOnNewWebNavigationBars | Returns or sets a Boolean value that specifies whether a link to a Web page will be added to the automatic navigation bars of new pages. Read/write.
Keywords | Returns or sets a String that represents the keywords for a Web page within a Web publication. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
PublishFileName | Returns or sets a String that represents the file name of a Web page (within a Web publication) that is being saved as filtered HTML.


WizardValue Members (Publisher)

 Copy code hover
[image]

WizardValue Members (Publisher)
Send feedback

Represents a possible value for the specified wizard property.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
ID | Returns a Long that represents the type of a shape, range of shapes, or property, type, or value of a wizard. Read-only.
Name | Returns a String value indicating the name of the specified object. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


WebListBoxItems Members (Publisher)

 Copy code hover
[image]

WebListBoxItems Members (Publisher)
Send feedback

Represents the items in a Web list box control.

Methods

Name | Description
AddItem | Adds list items to a Web list box control.
Delete | Deletes the specified hidden Web field or Web list box item object.
Item | Returns a String corresponding to the value of a hidden field in a Web form or a list item in a Web list box control.
Selected | Selects or cancels the selection of an item in a Web list box control.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Section Object (Publisher)

 Copy code hover
[image]

Section Object (Publisher)
Send feedback

Represents a Section of a publication or document.

Example

Use Sections.Item(index) where index is the index number, to return a single Section object. The following example sets a Section object to the first section in the Sections collection of the active document.

Copy code Copy code
Dim objSection As Section
Set objSection = ActiveDocument.Sections.Item(1)

Use Sections.Add(StartPageIndex) where StartPageIndex is the index number of the page, to return a new section added to a document. A "Permission denied." error will be returned if the page already contains a section head. The following example adds a Section object to the second page of the active document.

Copy code Copy code
Dim objSection As Section
Set objSection = ActiveDocument.Sections.Add(StartPageIndex:=2)


PbMailMergeDestination Enumeration (Publisher)

 Copy code hover
[image]

PbMailMergeDestination Enumeration (Publisher)
Send feedback

The destination of the mail merge or catalog merge results.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbMergeToExistingPublication | 3 | Default Merge to an exisiting presentation.
pbMergeToNewPublication | 2 | Merge to a new presentation.
pbSendEmail | 4 | Merge and send as an e-mail message.
pbSendToPrinter | 1 | Merge and send to the printer.


TextRange Methods (Publisher)

 Copy code hover
[image]

TextRange Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Characters | Returns a TextRange object that represents the specified subset of text characters.
Collapse | Collapses a range or selection to the starting position or ending position. After a range or selection is collapsed, the starting point and the ending point are equal.
Copy | Copies the specified object to the Clipboard.
Cut | Deletes the specified object and places it on the Clipboard.
Delete | Deletes the specified object.
Expand | Expands the specified range or selection. Returns or sets a Long that represents the number of specified units added to the range or selection.
InsertAfter | Returns a TextRange object that represents text appended to the end of a text range.
InsertBarcode | Inserts a bar code field at the end of the text range represented by the parent TextRange object.
InsertBefore | Appends a string to the beginning of the specified text range. Returns a TextRange object that represents the appended text. When used without an argument, this method returns a zero-length string at the end of the specified range.
InsertDateTime | Returns a TextRange object that represents the date and time inserted into a specified text range.
InsertMailMergeField | Returns a TextRange object that represents a text data field for a mail merge or catalog merge.
InsertPageNumber | Returns a TextRange object that represents a page number field in a publication.
InsertSymbol | Returns a TextRange object that represents a symbol inserted in place of the specified range or selection.
Lines | Returns a TextRange object that represents the specified lines.
Move | Collapses the specified range to its start position or end position and then moves the collapsed object by the specified number of units. This method returns a Long that represents the number of units by which the object was actually moved, or it returns 0 (zero) if the move was unsuccessful.
MoveEnd | Moves the ending character position of a range. This method returns a Long that represents the number of units the range or selection actually moved or returns 0 (zero) if the move was unsuccessful.
MoveStart | Moves the start position of the specified range. This method returns a Long that indicates the number of units by which the start position or the range or selection actually moved, or it returns 0 (zero) if the move was unsuccessful.
Paragraphs | Returns a TextRange object that represents the specified paragraphs.
Paste | Pastes the text on the Clipboard into the specified text range, and returns a TextRange object that represents the pasted text.
Select | Selects the specified object.
Words | Returns a TextRange object that represents the specified subset of text words.


PageSize.Name Property (Publisher)

 Copy code hover
[image]

PageSize.Name Property (Publisher)
Send feedback

Returns the name of the blank page size represented by the parent PageSize object. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .Name

expression A variable that represents a PageSize object.

Return Value

String

Remarks

The blank page size represented by the parent PageSize object corresponds to one of the icons displayed under Blank Page Sizes in the Page Setup dialog box in the Microsoft Publisher user interface.


Column Object (Publisher)

 Copy code hover
[image]

Column Object (Publisher)
Send feedback

Represents a single table column. The Column object is a member of the Columns collection. The Columns collection includes all the columns in a table, selection, or range.

Example

Use Columns(index), where index is the column number, to return a single Column object. The index number represents the position of the column in the Columns collection (counting from left to right). This example selects column three in the first shape in the active publication. This example assumes the first shape is a table and not another type of shape.

Copy code Copy code
Sub SelectColumn()
 ActiveDocument.Pages(2).Shapes(1).Table.Columns(3).Cells.Select
End Sub

Use the Item method of a Columns collection to return a Column object. This example enters text into the first cell of the third column of the specified table and formats the text with a bold, 15-point font. This example assumes the first shape is a table and not another type of shape.

Copy code Copy code
Sub ColumnHeading()
 With ActiveDocument.Pages(2).Shapes(1).Table.Columns(3) _
 .Cells(1).Text
 .Text = "Sales"
 .Font.Bold = msoTrue
 .Font.Size = 15
 End With
End Sub

Use the Delete method to delete a column from a table. This example deletes the column added in the above example.

Copy code Copy code
Sub DeleteColumn()
 ActiveDocument.Pages(2).Shapes(1).Table.Columns(3).Delete
End Sub


Wizard.Parent Property (Publisher)

 Copy code hover
[image]

Wizard.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a Wizard object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


MailMergeMappedDataFields Object (Publisher)

 Copy code hover
[image]

MailMergeMappedDataFields Object (Publisher)
Send feedback

A collection of MailMergeMappedDataField objects that represents the mapped data fields available in Microsoft Publisher.

Example

Use the MappedDataFields property of the MailMergeDataSource object to return the MailMergeMappedDataFields collection. This example creates a table on a new page of the current publication and lists the mapped data fields available in Publisher and the fields in the data source to which they are mapped. This example assumes that the current publication is a mail merge publication and that the data source fields have corresponding mapped data fields.

Copy code Copy code
Sub MappedFields()
 Dim intCount As Integer
 Dim intRows As Integer
 Dim docPub As Document
 Dim pagNew As Page
 Dim shpTable As Shape
 Dim tblTable As Table
 Dim rowTable As Row

 On Error Resume Next

 Set docPub = ThisDocument
 Set pagNew = ThisDocument.Pages.Add(Count:=1, After:=1)
 intRows = docPub.MailMerge.DataSource.MappedDataFields.Count + 1

 'Creates new table with a heading row
 Set shpTable = pagNew.Shapes.AddTable(NumRows:=intRows, _
 numColumns:=2, Left:=100, Top:=100, Width:=400, Height:=12)
 Set tblTable = shpTable.Table
 With tblTable.Rows(1)
 With .Cells(1).Text
 .Text = "Mapped Data Field"
 .Font.Bold = msoTrue
 End With
 With .Cells(2).Text
 .Text = "Data Source Field"
 .Font.Bold = msoTrue
 End With
 End With

 With docPub.MailMerge.DataSource
 For intCount = 2 To intRows - 1
 'Inserts mapped data field name and the
 'corresponding data source field name
 tblTable.Rows(intCount - 1).Cells(1).Text _
 .Text = .MappedDataFields(Index:=intCount).Name
 tblTable.Rows(intCount - 1).Cells(2).Text _
 .Text = .MappedDataFields(Index:=intCount).DataFieldName
 Next
 End With
End Sub


BorderArts Members (Publisher)

 Copy code hover
[image]

BorderArts Members (Publisher)
Send feedback

A collection of all BorderArt available for use in the specified publication. BorderArt is predefined picture borders that can be applied to text boxes, picture frames, or rectangles.

Methods

Name | Description
Item | Returns an individual object in a specified collection.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Plates.Add Method (Publisher)

 Copy code hover
[image]

Plates.Add Method (Publisher)
Send feedback

Adds a new color plate to the specified Plates object.

Syntax

expression .Add(PlateColor)

expression A variable that represents a Plates object.

Parameters

Name | Required/Optional | Data Type | Description
PlateColor | Optional | ColorFormat | ColorFormat object. The color settings to apply to the new plate.

Remarks

If the ColorMode property of the specified publication is not pbColorModeSpot or pbColorModeSpotAndProcess, an error occurs.

Example

The following example adds a color plate to the active publication if it is a spot-color publication.

VBA Copy code Copy code
If ActiveDocument.ColorMode = pbColorModeSpot Then
 ActiveDocument.Plates.Add
End If


RulerGuide.Type Property (Publisher)

 Copy code hover
[image]

RulerGuide.Type Property (Publisher)
Send feedback

Returns or sets a PbRulerGuideType constant that represents the ruler guide type. Read/write.

Syntax

expression .Type

expression A variable that represents a RulerGuide object.

Remarks

The Type property value can be one of these PbRulerGuideType constants.

pbRulerGuideTypeHorizontal

pbRulerGuideTypeVertical


MailMergeDataField Members (Publisher)

 Copy code hover
[image]

MailMergeDataField Members (Publisher)
Send feedback

Represents a single merge field in a data source. The MailMergeDataField object is a member of the MailMergeDataFields collection. The MailMergeDataFields collection includes all the data fields in a mail merge or catalog merge data source (for example, Name, Address, and City).

Methods

Name | Description
AddToRecipientFields | Adds the parent MailMergeDataField object from a particular data source to the master data source (collection of data fields) for a mail-merge publication.
Insert | Returns a Shape object that represents a data field inserted into a publication.
MapToRecipientField | Maps a field (column) in a particular data source represented by the parent MailMergeDataField object to a recipient field (column) in the master data source (combined mail-merge recipient list).
UnMapRecipientField | Undoes the mapping between the parent MailMergeDataField object in a particular data source and the recipient field in the master data source (combined mail-merge recipient list) to which it is currently mapped.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Creator | Returns a Long that represents the application in which the specified object was created. For example, if the object was created in Microsoft Publisher, this property returns the hexadecimal number 4D505542, which represents the string "MSPB." This value can also be represented by the constant.
FieldType |
Index | Returns a Long that represents the position of a particular item in a specified collection. .
IsMapped | Indicates if the parent MailMergeDataField object is mapped to a recipient field in the master data source (combined mail-merge recipient list). Read-only.
MappedTo | Returns the name of the recipient field (column) in the master data source (combined mail-merge recipient list) that the parent MailMergeDataField object is mapped to. Read-only.
Name | Returns a String value indicating the name of the specified object. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Value | Returns a String that represents the value of a mail merge data field record or a mapped data field. Read-only.


PbWizardTag Enumeration (Publisher)

 Copy code hover
[image]

PbWizardTag Enumeration (Publisher)
Send feedback

Indicates the function of a specified shape with respect to its publication design.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbWizardTagAddress | 10 | Address
pbWizardTagAddressGroup | 117 | Address Group
pbWizardTagBriefDescriptionCaption | 1361 | Description Caption
pbWizardTagBriefDescriptionGraphic | 1359 | Description Graphic
pbWizardTagBriefDescriptionSummary | 1353 | Description Summary
pbWizardTagBriefDescriptionSummaryPrimary | 1365 | Description Summary Primary
pbWizardTagBriefDescriptionTitle | 1364 | Brief Description Title
pbWizardTagBusinessDescription | 685 | Business Description
pbWizardTagCustomerMailingAddress | 560 | Customer Mailing Address
pbWizardTagDate | 1835 | Tag Date
pbWizardTagEAPostalCodeBox | 2151 | EA Postal Code Box
pbWizardTagEAPostalCodeGroup | 2150 | EA Postal Code Group
pbWizardTagEAPostalCodeLine | 2152 | EA Postal Code Line
pbWizardTagFloatingGraphicCaption | 1362 | Floating Graphic Caption
pbWizardTagHourTimeDateInformation | 684 | Hour Time Date Information
pbWizardTagJobTitle | 115 | Job Title
pbWizardTagLinkedStoryPrimary | 1354 | Linked Primary Story
pbWizardTagLinkedStorySecondary | 1355 | Secondary Story
pbWizardTagLinkedStoryTertiary | 1356 | Linked Story Tertiary
pbWizardTagList | 1837 | List
pbWizardTagLocation | 488 | Location
pbWizardTagLogoGroup | 5 | Logo Group
pbWizardTagMainFloatingGraphic | 1357 | Main Floating Graphic
pbWizardTagMainGraphic | 1833 | Main Graphic
pbWizardTagMainTitle | 1832 | Title
pbWizardTagMapPicture | 489 | Picture
pbWizardTagMasthead | 1831 | Masthead
pbWizardTagNewsletterTitle | 1344 | Newsletter Title
pbWizardTagOrganizationName | 7 | Organization Name
pbWizardTagOrganizationNameGroup | 118 | Organization Name Group
pbWizardTagPageNumber | 1346 | Page Number
pbWizardTagPersonalName | 8 | Personal Name
pbWizardTagPersonalNameGroup | 116 | Personal Name Group
pbWizardTagPhoneFaxEmail | 113 | Phone/Fax/E-mail
pbWizardTagPhoneFaxEmailGroup | 120 | Phone/Fax/E-mail Group
pbWizardTagPhoneNumber | 114 | Phone Number
pbWizardTagPhotoPlaceholderFrame | 1134 | Photo Placeholder Frame
pbWizardTagPhotoPlaceholderText | 1135 | Photo Placeholder Text
pbWizardTagPublicationDate | 1341 | Publication Date
pbWizardTagQuickPubContent | 2143 | Quick Pub Content
pbWizardTagQuickPubHeading | 2140 | Quick Pub Heading
pbWizardTagQuickPubMessage | 2141 | Quick Pub Message
pbWizardTagQuickPubPicture | 2142 | Quick Pub Picture
pbWizardTagReturnAddressLines | 793 | Return Address Lines
pbWizardTagStampBox | 887 | Stamp Box
pbWizardTagStampBoxOutline | 794 | Stamp Box Outline
pbWizardTagStory | 1349 | Story
pbWizardTagStoryCaptionPrimary | 1351 | Caption Primary
pbWizardTagStoryCaptionSecondary | 1373 | Caption Secondary
pbWizardTagStoryGraphicPrimary | 1350 | Graphic Primary
pbWizardTagStoryGraphicSecondary | 1360 | Graphic Secondary
pbWizardTagStoryTitle | 1348 | Story Title
pbWizardTagTableOfContents | 1343 | Table of Contents
pbWizardTagTableOfContentsTitle | 1342 | Table of Contents Title
pbWizardTagTagLine | 112 | Tag Line
pbWizardTagTagLineGroup | 119 | Tag Line Group
pbWizardTagTime | 1836 | Tag Time


PageSizes.Item Property (Publisher)

 Copy code hover
[image]

PageSizes.Item Property (Publisher)
Send feedback

Returns the PageSize object with the specified name or at the specified index position in the PageSizes collection. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .Item(Index)

expression A variable that represents a PageSizes collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index position of a PageSize object.

Return Value

PageSize


ShapeRange.HasTextFrame Property (Publisher)

 Copy code hover
[image]

ShapeRange.HasTextFrame Property (Publisher)
Send feedback

Indicates whether the specified shape has a TextFrame object associated with it. Read-only.

Syntax

expression .HasTextFrame

expression A variable that represents a ShapeRange object.

Remarks

If the HasTextFrame property is true, clients must check the value of the HasText property of the TextFrame object to determine if there is any text on the shape.

The HasTextFrame property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The specified shape does not have a TextFrame object associated with it.
msoTriStateMixed | Indicates a combination of msoTrue and msoFalse for the specified shape range.
msoTrue | The specified shape has a TextFrame object associated with it.

Example

This example tests all the shapes in the selection and if none have text frames associated with them, they are left aligned.

VBA Copy code Copy code
Sub MoveLeft()

 Dim shpAll As ShapeRange

 Set shpAll = Application.ActiveDocument.Selection.ShapeRange
 If shpAll.HasTextFrame = msoFalse Then
 shpAll.Align msoAlignLefts, msoTrue
 End If

End Sub


Shape.WebTextBox Property (Publisher)

 Copy code hover
[image]

Shape.WebTextBox Property (Publisher)
Send feedback

Returns the WebTextBox object associated with the specified shape.

Syntax

expression .WebTextBox

expression A variable that represents a Shape object.

Return Value

WebTextBox

Example

This example creates a new Web text box, specifies default text, indicates that entry is required, and limits entry to 50 characters.

VBA Copy code Copy code
Dim shpNew As Shape
Dim wtbTemp As WebTextBox

Set shpNew = ActiveDocument.Pages(1).Shapes _
 .AddWebControl(Type:=pbWebControlSingleLineTextBox, _
 Left:=100, Top:=100, Width:=150, Height:=15)

Set wtbTemp = shpNew.WebTextBox

With wtbTemp
.DefaultText = "Please Enter Your Full Name"
 .RequiredControl = msoTrue
 .Limit = 50
End With


Application.ShowCatalogUI Event (Publisher)

 Copy code hover
[image]

Application.ShowCatalogUI Event (Publisher)
See also Send feedback

Fires when the catalog of publication wizards is displayed in the Microsoft Publisher user interface.

Version Information

Version Added: Publisher 2007

Syntax

expression .ShowCatalogUI

expression An expression that returns a Application object.

Remarks

You can use the Application.ShowWizardCatalog method to display the wizard catalog in the user interface.

The ShowCatalogUI event does not fire when the publication catalog is displayed when Publisher first starts. To determine if the catalog is displayed at that time, you can use the WizardCatalogVisible property.

For more information about using events with the Application object, see Using Events with the Application Object.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to handle the ShowCatalogUI event. It displays a message notifying the user that the catalog UI was displayed.

VBA Copy code Copy code
Private Sub pubApplication_ShowCatalogUI()
 MsgBox "The Wizard Catalog is displayed."
End Sub

For this event to occur, you must place the following line of code in the General Declarations section of your module.

VBA Copy code Copy code
Private WithEvents pubApplication As Application

Then run the following initialization procedure.

VBA Copy code Copy code
Public Sub Initialize_pubApplication()
 Set pubApplication = Publisher.Application
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Row Methods (Publisher)

 Copy code hover
[image]

Row Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified object.


PbTextDirection Enumeration (Publisher)

 Copy code hover
[image]

PbTextDirection Enumeration (Publisher)
Send feedback

Indicats the direction in which text flows in the specified paragraph.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbTextDirectionLeftToRight | 1 | Text flows from left to right.
pbTextDirectionMixed | -9999999 | Return value indicating a range containing some left-to-right text and some right-to-left text.
pbTextDirectionRightToLeft | 2 | Text flows from right to left.


RulerGuide.Application Property (Publisher)

 Copy code hover
[image]

RulerGuide.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a RulerGuide object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


TextStyles Object (Publisher)

 Copy code hover
[image]

TextStyles Object (Publisher)
Send feedback

A collection of TextStyle objects that represent both the built-in and user-defined styles in a document.

Example

Use the TextStyles property to return the TextStyles collection. The following example creates a table and lists all the styles in the active publication.

Copy code Copy code
Sub ListTextStyles()
 Dim sty As TextStyle
 Dim tbl As Table
 Dim intRow As Integer

 With ActiveDocument
 Set tbl = .Pages(1).Shapes.AddTable(NumRows:=.TextStyles.Count, _
 NumColumns:=2, Left:=72, Top:=72, Width:=488, Height:=12).Table
 For Each sty In .TextStyles
 intRow = intRow + 1
 With tbl.Rows(intRow)
 .Cells(1).text = sty.Name
 .Cells(2).text = sty.BaseStyle
 End With
 Next sty
 End With
End Sub

Use the Add method to create a new user-defined style and add it to the TextStyles collection. The following example creates a new style and applies it to the paragraph at the cursor position.

Copy code Copy code
Sub ApplyTextStyle()
 Dim styNew As TextStyle
 Dim fntStyle As Font

 'Create a new style
 Set styNew = ActiveDocument.TextStyles.Add(StyleName:="NewStyle")
 Set fntStyle = styNew.Font

 'Format the Font object
 With fntStyle
 .Name = "Tahoma"
 .Size = 20
 .Bold = msoTrue
 End With

 'Apply the Font object formatting to the new style
 styNew.Font = fntStyle

 'Apply the new style to the selected paragraph
 Selection.TextRange.ParagraphFormat.TextStyle = "NewStyle"
End Sub


Page.Footer Property (Publisher)

 Copy code hover
[image]

Page.Footer Property (Publisher)
Send feedback

Returns a HeaderFooter object representing the footer of the specified Page object. Read-only.

Syntax

expression .Footer

expression A variable that represents a Page object.

Return Value

HeaderFooter

Remarks

This property is only for master pages. A "This feature is only for master pages" error is returned if the Footer property is accessed from a Page object that is returned form the Pages collection. A new HeaderFooter object is created for the specified master page by accessing this property.

Example

The following example creates a HeaderFooter object and sets it to the footer of the first master page.

Copy code Copy code
Dim objFooter As HeaderFooter
Set objFooter = ActiveDocument.MasterPages(1).Footer

The HeaderFooter object returned by the Footer property can be used to manipulate the footer content. The following example sets some properties of the HeaderFooter object of the first master page.

Copy code Copy code
With ActiveDocument.masterPages(1)
 With .Header
 .TextRange.Text = "Windows" & Chr(13) & "Office" & Chr(13) & "Internet Explorer"
 With .TextRange.ParagraphFormat
 .SetListType Value:=pbListTypeBullet, BulletText:="*"
 .Alignment = pbParagraphAlignmentLeft
 End With
 End With
 With .Footer
 .TextRange.Hyperlinks.Add Text:=.TextRange, _
 Address:="http://www.tailspintoys.com", _
 TextToDisplay:="Tailspin"
 End With
End With


Field.Parent Property (Publisher)

 Copy code hover
[image]

Field.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a Field object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


ColorFormat.SchemeColor Property (Publisher)

 Copy code hover
[image]

ColorFormat.SchemeColor Property (Publisher)
Send feedback

Specifies the color of the current color scheme. Read/write.

Syntax

expression .SchemeColor

expression A variable that represents a ColorFormat object.

Return Value

PbSchemeColorIndex

Remarks

The SchemeColor property value can be one of the PbSchemeColorIndex constants declared in the Microsoft Publisher type library.

Example

The following example sets the color of the text in shape one on page one of the active publication to accent color five in the current color scheme.

VBA Copy code Copy code
ActiveDocument.Pages(1).Shapes(1).TextFrame _
 .TextRange.Font.Color.SchemeColor =
VBA Copy code Copy code
pbSchemeColorAccent5


WrapFormat.DistanceAuto Property (Publisher)

 Copy code hover
[image]

WrapFormat.DistanceAuto Property (Publisher)
Send feedback

Returns or sets an MsoTriState constant indicating whether an appropriate distance between an inline shape and any surrounding text is automatically calculated. Read/write.

Syntax

expression .DistanceAuto

expression A variable that represents a WrapFormat object.

Return Value

MsoTriState

Remarks

The DistanceAuto property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The shape's edges are not adjusted depending on the margins of the text box it overlaps.
msoTriStateMixed | Return value indicating a combination of msoTrue and msoFalse for the specified shape range.
msoTriStateToggle | Set value that switches the property value between msoTrue and msoFalse.
msoTrue | The default. The shape's edges are automatically adjusted depending on the margins of the text box it overlaps.

Example

The following example sets shape one on page one of the active publication so that its edges are not automatically adjusted based on its distance from surrounding text.

VBA Copy code Copy code
Sub SetDistanceAutoProperty()
 With ActiveDocument.Pages(1).Shapes(1).TextWrap
 .Type = pbWrapTypeSquare
 .DistanceAuto = msoFalse
 End With
End Sub


Returning an Object from a Collection (Publisher)

 Copy code hover
[image]

Returning an Object from a Collection (Publisher)
Send feedback

The Item method returns a single object from a collection. The following example sets a variable to a Page object that represents the first page in the Pages collection.

Copy code Copy code
Sub SetFirstPage()
 Dim pgFirst As Page
 Set pgFirst = ActiveDocument.Pages.Item(1)
End Sub

The Item method is the default method for most collections, so you can write the same statement more concisely by omitting the Item keyword.

Copy code Copy code
Sub SetFirstPage()
 Dim pgFirst As Page
 Set pgFirst = ActiveDocument.Pages(1)
End Sub


PbWizardPageType Enumeration (Publisher)

 Copy code hover
[image]

PbWizardPageType Enumeration (Publisher)
Send feedback

The type of wizard page to add.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbWizardPageTypeCatalogBlank | 35 | CatalogBlank
pbWizardPageTypeCatalogCalendar | 22 | Calendar
pbWizardPageTypeCatalogEightItemsOneColumn | 33 | CatalogEightItemsOneColumn
pbWizardPageTypeCatalogEightItemsTwoColumns | 34 | CatalogEightItemsTwoColumns
pbWizardPageTypeCatalogFeaturedItem | 24 | CatalogFeaturedItem
pbWizardPageTypeCatalogForm | 36 | Catalog Form
pbWizardPageTypeCatalogFourItemsAlignedPictures | 30 | Catalog Four Items Aligned Pictures
pbWizardPageTypeCatalogFourItemsOffsetPictures | 31 | Catalog Four Items Offset Pictures
pbWizardPageTypeCatalogFourItemsSquaredPictures | 32 | Catalog Four Items Squared Pictures
pbWizardPageTypeCatalogOneColumnText | 18 | Catalog One Column Text
pbWizardPageTypeCatalogOneColumnTextPicture | 19 | Catalog One Column Text Picture
pbWizardPageTypeCatalogTableOfContents | 23 | Catalog Table of Contents
pbWizardPageTypeCatalogThreeItemsAlignedPictures | 27 | Three Items Aligned Pictures
pbWizardPageTypeCatalogThreeItemsOffsetPictures | 28 | Three Items Offset Pictures
pbWizardPageTypeCatalogThreeItemsStackedPictures | 29 | Three Items Stacked Pictures
pbWizardPageTypeCatalogTwoColumnsText | 20 | Catalog Two Columns Text
pbWizardPageTypeCatalogTwoColumnsTextPicture | 21 | Catalog Two Columns Text Picture
pbWizardPageTypeCatalogTwoItemsAlignedPictures | 25 | Two Items Aligned Pictures
pbWizardPageTypeCatalogTwoItemsOffsetPictures | 26 | Two Items Offset Pictures
pbWizardPageTypeNewsletter3Stories | 1 | Newsletter3 Stories
pbWizardPageTypeNewsletterCalendar | 2 | Newsletter Calendar
pbWizardPageTypeNewsletterOrderForm | 15 | Newsletter OrderForm
pbWizardPageTypeNewsletterResponseForm | 16 | Newsletter Response Form
pbWizardPageTypeNewsletterSignupForm | 17 | Newsletter Signup Form
pbWizardPageTypeNone | -1 | None
pbWizardPageTypeWebAboutUs | 501 | Web About Us
pbWizardPageTypeWebArticle | 512 | Web Article
pbWizardPageTypeWebBlank | 524 | Web Blank
pbWizardPageTypeWebCalendarPage | 504 | Web Calendar Page
pbWizardPageTypeWebCalendarWithLinks | 800 | Web Calendar With Links
pbWizardPageTypeWebContactUs | 505 | Web Contact Us
pbWizardPageTypeWebEmployee | 507 | Web Employee
pbWizardPageTypeWebEmployeeList | 506 | Web Employee List
pbWizardPageTypeWebEmployeesWithLinks | 802 | Web Employees With Links
pbWizardPageTypeWebFAQ | 508 | Web FAQ
pbWizardPageTypeWebHome | 509 | Web Home
pbWizardPageTypeWebInformational | 502 | Web Informational
pbWizardPageTypeWebJobs | 510 | Web Jobs
pbWizardPageTypeWebLegal | 511 | Web Legal
pbWizardPageTypeWebLinks | 518 | Web Links
pbWizardPageTypeWebList | 503 | Web List
pbWizardPageTypeWebOrderForm | 525 | Web Order Form
pbWizardPageTypeWebPhoto | 513 | Web Photo
pbWizardPageTypeWebPhotoGallery | 514 | Web Photo Gallery
pbWizardPageTypeWebPhotosWithLinks | 805 | Web Photos With Links
pbWizardPageTypeWebProduct | 515 | Web Product
pbWizardPageTypeWebProductList | 516 | Web Product List
pbWizardPageTypeWebProductsWithLinks | 801 | Web Products With Links
pbWizardPageTypeWebProjectList | 517 | Web Project List
pbWizardPageTypeWebProjectsWithLinks | 804 | Web Projects With Links
pbWizardPageTypeWebResponseForm | 526 | Web Response Form
pbWizardPageTypeWebSeminar | 519 | Web Seminar
pbWizardPageTypeWebService | 521 | Web Service
pbWizardPageTypeWebServiceList | 520 | Web Service List
pbWizardPageTypeWebServicesWithLinks | 803 | Web Services With Links
pbWizardPageTypeWebSignupForm | 527 | Web Signup Form
pbWizardPageTypeWebSpecial | 522 | Web Special


PrintableRect.Application Property (Publisher)

 Copy code hover
[image]

PrintableRect.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a PrintableRect object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


PbWrapSideType Enumeration (Publisher)

 Copy code hover
[image]

PbWrapSideType Enumeration (Publisher)
Send feedback

Indicates whether text should wrap around a shape.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbWrapSideBoth | 0 | Wrap both sides of the shape
pbWrapSideLarger | 3 | Wrap the larger side of the shape
pbWrapSideLeft | 1 | Wrap the left side of the shape
pbWrapSideMixed | -1 | Wrap the the shape in different proportions
pbWrapSideNeither | 4 | Does not wrap the shape on the sides
pbWrapSideRight | 2 | Wrap the right side of the shape


AdvancedPrintOptions Members (Publisher)

 Copy code hover
[image]

AdvancedPrintOptions Members (Publisher)
Send feedback

Represents the advanced print settings for a publication.

Properties

Name | Description
AllowBleeds | True to allow bleeds to print for the specified publication. The default is True. Read/write Boolean.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
BackSideInsertFaceUp | Gets or sets whether envelopes fed to the printer's manual feed should be inserted back-side first and face up. Read/write.
GraphicsResolution | Returns or sets a PbPrintGraphics constant representing the resolution at which the inserted graphics are to be printed in the specified publication. Read/write.
HorizontalFlip | True to print a horizontally mirrored image of the specified publication. The default is False. Read/write Boolean.
IsPostscriptPrinter | Returns True if the active printer is a PostScript printer. Read-only Boolean.
ManualFeedAlign | Gets or sets the alignment (left, right, or center) of where envelopes are fed to the printer's manual feed. Read/write.
ManualFeedDirection | Gets or sets the orientation (landscape or portrait) of how envelopes are fed to the printer's manual feed. Read/write.
NegativeImage | True to print a negative image of the specified publication. The default is False. Read/write Boolean.
PageRotated | Gets or sets whether the printed page is rotated 180 degrees. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
PrintBleedMarks | True to print bleed marks in the specified publication. The default is False. Read/write Boolean.
PrintCropMarks | True to print crop marks for the specified publication. The default is True. Read/write Boolean.
PrintDensityBars | True to print a density bar for the specified publication. The default is True. Read/write Boolean.
PrintJobInformation | True to print information about the print job on each plate. The default is True. Read/write Boolean.
PrintRegistrationMarks | True to print registration marks for the specified publication. The default is True. Read/write Boolean.
Resolution | Returns or sets a String that represents the resolution, in dots per inch (dpi), at which to print the specified publication. Default is dependent on the printer driver, but is usually "(default)". Read/write.
UseOnlyPublicationFonts | Returns or sets a Boolean that represents whether to only use publication fonts for printing the specified publication. True to print the specified publication using only fonts downloaded from your computer. Read/write. The default is True.
VerticalFlip | True to print a vertically mirrored image of the specified publication. The default is False. Read/write Boolean.


PictureFormat.FileSize Property (Publisher)

 Copy code hover
[image]

PictureFormat.FileSize Property (Publisher)
Send feedback

Returns a Long that represents, in bytes, the size of the picture or OLE object as it appears in the specified publication. Read-only.

Syntax

expression .FileSize

expression A variable that represents a PictureFormat object.

Return Value

Long

Remarks

If the picture or OLE object is linked, use the OriginalFileSize property to determine the size of the linked file.

To determine whether a shape represents a linked picture, use either the Type property of the Shape object, or the IsLinked property of the PictureFormat object.

Example

The following example tests each picture in the active publication, and prints selected image properties for pictures that are linked.

Copy code Copy code
Dim pgLoop As Page
Dim shpLoop As Shape

For Each pgLoop In ActiveDocument.Pages
 For Each shpLoop In pgLoop.Shapes
 If shpLoop.Type = pbLinkedPicture Then

 With shpLoop.PictureFormat

 Debug.Print "File Name: " & .Filename
 Debug.Print "Original File Size: " & .OriginalFileSize & " bytes"
 Debug.Print "File size in publication: " & .FileSize & " bytes"
 End With
 End If
 Next shpLoop
Next pgLoop


ThreeDFormat.PresetLightingSoftness Property (Publisher)

 Copy code hover
[image]

ThreeDFormat.PresetLightingSoftness Property (Publisher)
Send feedback

Returns or sets a MsoPresetLightingSoftness constant that represents the intensity of the extrusion lighting. Read/write.

Syntax

expression .PresetLightingSoftness

expression A variable that represents a ThreeDFormat object.

Return Value

MsoPresetLightingSoftness

Remarks

The PresetLightingSoftness property value can be one of the MsoPresetLightingSoftness constants declared in the Microsoft Office type library.

Example

This example sets the extrusion for the first shape on the first page of the active publication to be lit brightly from the left. For this example to work, the specified shape must be a 3-D shape.

VBA Copy code Copy code
Sub SetExtrusionLightingBrighness()
 With ActiveDocument.Pages(1).Shapes(1).ThreeD
 .Visible = True
 .PresetLightingSoftness = msoLightingBright
 .PresetLightingDirection = msoLightingLeft
 End With
End Sub


Document.ExportAsFixedFormat Method (Publisher)

 Copy code hover
[image]

Document.ExportAsFixedFormat Method (Publisher)
Send feedback

Saves a Microsoft Publisher publication in PDF or XPS format. The conversion readies the document to be sent to commercial presses, to copy shops, for desktop printing, or for electronic distribution.

Version Information

Version Added: Publisher 2007

Syntax

expression .ExportAsFixedFormat(Format, Filename, Intent, IncludeDocumentProperties, ColorDownsampleTarget, ColorDownsampleThreshold, OneBitDownsampleTarget, OneBitDownsampleThreshold,From,To,Copies,Collate,PrintStyle,DocStructureTags,BitmapMissingFonts,UseISO19005_1,ExternalExporter)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Format | Required | PbFixedFormatType | The format in which you want to export the publication. See Remarks for possible values.
Filename | Required | String | The file name for the exported file.
Intent | Optional | PbFixedFormatIntent | The output quality of the exported file. See Remarks for possible values.
IncludeDocumentProperties | Optional | Boolean | True if you want to save the document properties with the PDF file.
ColorDownsampleTarget | Optional | Long | The target for down-sampling of colored images. Measured in dots per inch. Must be greater than 96
ColorDownsampleThreshold | Optional | Long | The threshold at or above which an image is down-sampled to the ColorDownsample target level.
OneBitDownsampleTarget | Optional | Long | The target for down-sampling of one-bit images.
OneBitDownsampleThreshold | Optional | Long | The threshold at or above which an image is down-sampled to the OneBitDownsample target level.
From | Optional | Long | The page number of the first page to export.
To | Optional | Long | The page number of the last page to export.
Copies | Optional | Long | The number of copies.
Collate | Optional | Boolean | Whether to collate the copies.
PrintStyle | Optional | PbPrintStyle | The style in which to print the exported file. See Remarks for possible values.
DocStructureTags | Optional | Boolean | Whether to include document structure tags to improve document accessibility. The default is True.
BitmapMissingFonts | Optional | Boolean | Whether to include a bitmap of the text. Pass True for this parameter when font licenses do not permit a font to be embedded in the PDF file. If you pass False, the font is referenced, and the viewer's computer substitutes an appropriate font if the authored one is not available. Default value is True.
UseISO19005_1 | Optional | Boolean | Whether the resulting document is compliant with ISO 19005-1 (PDF/A). The default is False.
ExternalExporter | Optional | Variant | A pointer to an add-in that allows calls to an alternate implementation of code. You can add support for additional fixed formats by writing a Microsoft Office add-in that implements the IMsoDocExporter COM interface. For more information, see "Extending the Office (2007) Fixed-Format Export Feature" on MSDN.

Remarks

The ExportAsFixedFormat method is the equivalent of the Publish As PDF or XPS command on the File menu in the Publisher user interface.

Possible values for the Format parameter are shown in the following table and declared in PbFixedFormatType in the Publisher type library.

Constant | Value | Description
pbFixedFormatTypePDF | 2 | PDF format
pbFixedFormatTypeXPS | 1 | XPS format

Possible values for the Intent parameter are shown in the following table and declared in PbFixedFormatIntent in the Publisher type library.

Constant | Value | Description
pbIntentMinimum | 1 | Squeeze the publication to the smallest file size. This satisfies the on-screen viewing scenario where the publication is viewed on a computer monitor.
pbIntentStandard | 2 | Distribute the publication as an e-mail message or from a Web site. Note that the user does not know how the publication will be viewed: on-screen or printed from a desktop printer. Both the desktop printing scenario and the on-screen viewing scenario must be met by this intent.
pbIntentPrinting | 3 | Print the publication on a desktop printer or at a copy store.
pbIntentCommercial | 4 | Submit the publication to a commercial press.

Possible values for the PrintStyle parameter are declared in the PbPrintStyle enumeration in the Publisher type library. The default value depends on the value of the Intent parameter.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the ExportAsFixedFormat method to save the the active publication as a .pdf file.

Before running this code, replace pathandfilename.pdf with a valid file name and the path to a folder on your computer where you have permission to save files.

VBA Copy code Copy code
Public Sub ExportAsFixedFormat_Example()

 ThisDocument.ExportAsFixedFormat pbFixedFormatTypePDF, "pathandfilename.pdf"

End Sub


ShapeNode.Application Property (Publisher)

 Copy code hover
[image]

ShapeNode.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a ShapeNode object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Tag.Parent Property (Publisher)

 Copy code hover
[image]

Tag.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a Tag object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Document.SurplusShapes Property (Publisher)

 Copy code hover
[image]

Document.SurplusShapes Property (Publisher)
Send feedback

Returns a ShapeRange object that represents the collection of surplus shapes that Microsoft Publisher places under Extra Content in the Format Publication task pane after the document template (wizard) is changed by using the Document.ChangeDocument method or by using the Change Template command in the user interface. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .SurplusShapes

expression A variable that represents a Document object.

Return Value

ShapeRange

Remarks

Publisher classifies a shape as surplus if it does not fit neatly into the new template after the template is changed.


OLEFormat Members (Publisher)

 Copy code hover
[image]

OLEFormat Members (Publisher)
Send feedback

Represents the OLE characteristics, other than linking (see the LinkFormat object), for an OLE object, ActiveX control, or field.

Methods

Name | Description
Activate | Activates a window or OLE object.
DoVerb | Requests that an OLE object perform one of its verbs.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Object | Returns an Object that represents the specified OLE object's top-level interface. This property allows you to access the properties and methods of an ActiveX control or the application in which an OLE object was created. The OLE object must support OLE Automation for this property to work. Read-only.
ObjectVerbs | Returns an ObjectVerbs collection that contains all the OLE verbs for the specified OLE object. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
ProgId | Returns a String that represents the programmatic identifier (ProgID) for the specified OLE object. Read-only.


PhoneticGuide.Raise Property (Publisher)

 Copy code hover
[image]

PhoneticGuide.Raise Property (Publisher)
Send feedback

Returns a Variant indicating the distance between the top of the base text and the bottom of the guide text. Read-only.

Syntax

expression .Raise

expression A variable that represents a PhoneticGuide object.

Return Value

Variant

Remarks

Numeric set values are in points; strings can be any measurement unit supported by Microsoft Publisher. Return values are always in points.

Example

The following example places the phonetic guide for shape one in the active publication five points above the base text.

VBA Copy code Copy code
Dim phoGuide As PhoneticGuide

Set phoGuide = ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.Fields(1).PhoneticGuide

With phoGuide
 .Raise = 5
End With


TextRange.Application Property (Publisher)

 Copy code hover
[image]

TextRange.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a TextRange object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


BorderArtFormat Methods (Publisher)

 Copy code hover
[image]

BorderArtFormat Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified object.
RevertToDefaultWeight | Sets the BorderArt on the specified shape back to its default thickness.
RevertToOriginalColor | Sets the BorderArt on the specified shape back to its default color.
Set | Sets the type of BorderArt applied to the specified shape.


PictureFormat.CropBottom Property (Publisher)

 Copy code hover
[image]

PictureFormat.CropBottom Property (Publisher)
Send feedback

Returns or sets a Variant indicating the amount by which the bottom edge of a picture or OLE object is cropped. Read/write.

Syntax

expression .CropBottom

expression A variable that represents a PictureFormat object.

Return Value

Variant

Remarks

Numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

Negative values crop the bottom edge away from the center of the frame and positive values crop toward the top edge of the frame.

The valid range of crop values depends on the frame's position and size. For an unrotated frame, the lowest negative value allowed is the distance between the bottom edge of frame and the bottom edge of the scratch area. The highest positive value allowed is the current frame height.

Cropping is calculated relative to the original size of the picture. For example, if you insert a picture that is originally 100 points high, rescale it so that it is 200 points high, and then set the CropBottom property to 50, 100 points (not 50) will be cropped off the bottom of your picture.

Use the CropLeft, CropRight, and CropTop properties to crop other edges of a picture or OLE object.

Example

This example crops 20 points off the bottom of the third shape in the active publication. For the example to work, the shape must be either a picture or an OLE object.

Copy code Copy code
ActiveDocument.Pages(1).Shapes(3).PictureFormat _
 .CropBottom = 20

This example crops the percentage specified by the user off the bottom of the selected shape, regardless of whether the shape has been scaled. For the example to work, the selected shape must be either a picture or an OLE object.

Copy code Copy code
Dim sngPercent As Single
Dim shpCrop As Shape
Dim sngPoints As Single
Dim sngHeight As Single

sngPercent = InputBox("What percentage do you " & _
 "want to crop off the bottom of this picture?")

Set shpCrop = Selection.ShapeRange(1)
With shpCrop.Duplicate
 .ScaleHeight Factor:=1, _
 RelativeToOriginalSize:=True
 sngHeight = .Height
 .Delete
End With

sngPoints = sngHeight * sngPercent / 100

shpCrop.PictureFormat.CropBottom = sngPoints


InstalledPrinters.Count Property (Publisher)

 Copy code hover
[image]

InstalledPrinters.Count Property (Publisher)
Send feedback

Returns the number of printers installed on your computer. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .Count

expression A variable that represents an InstalledPrinters collection.

Return Value

Int


WebOptions.RelyOnVML Property (Publisher)

 Copy code hover
[image]

WebOptions.RelyOnVML Property (Publisher)
Send feedback

Returns or sets a Boolean value that specifies whether image files are generated from drawing objects when a Web publication is saved. If True, image files are not generated. If False, images are generated. The default value is False. Read/write.

Syntax

expression .RelyOnVML

expression A variable that represents a WebOptions object.

Return Value

Boolean

Remarks

File sizes can be reduced by not generating images for drawing objects. Note that a Web browser must support Vector Markup Language (VML) to render drawing objects. Microsoft Internet Explorer versions 5.0 and later support VML, so the RelyOnVML property could be set to True if targeting those browsers. For browsers that do not support VML, a drawing object will not appear when a Web publication is saved with this property enabled.

If unsure about which browsers will be used to view the Web site, this property should be set to False.

Example

The following example assumes that end users have Microsoft Internet Explorer version 5.0, and therefore specifies that images should not be generated from drawing objects when the Web publication is saved.

VBA Copy code Copy code
Dim theWO As WebOptions

Set theWO = Application.WebOptions

With theWO
 .RelyOnVML = True
End With


WebHiddenFields Object (Publisher)

 Copy code hover
[image]

WebHiddenFields Object (Publisher)
Send feedback

Represents hidden Web fields that allow a Web page to pass non-visible data to the Web server when a Web page is submitted. The WebHiddenFields object enables control of all the hidden fields attached to a Submit command button.

Example

Use the HiddenFields property to access hidden Web fields. This example adds a new hidden Web field to a new Submit command button.

Copy code Copy code
Sub CreateActionWebButton()
 With ActiveDocument.Pages(1).Shapes
 With .AddWebControl _
 (Type:=pbWebControlCommandButton, Left:=150, _
 Top:=150, Width:=75, Height:=36).WebCommandButton
 .ButtonText = "Submit"
 .ButtonType = pbCommandButtonSubmit
 .HiddenFields.Add Name:="User", Value:="PowerUser"
 End With
 End With
End Sub


InstalledPrinters Object (Publisher)

 Copy code hover
[image]

InstalledPrinters Object (Publisher)
Send feedback

Represents the collection of all Printer objects, each of which represents one of the printers installed on the computer.

Version Information

Version Added: Publisher 2007

Remarks

To provide the user a choice of printers to print a publication, you can iterate through the InstalledPrinters collection to get a list of the names of all the printers installed on the computer, as shown in the following example.

The default property of the InstalledPrinters collection is Item.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how you can use the PrinterName and IsActivePrinter properties of the Printer object to get a list of all the installed printers on the computer and to determine which of them is currently the active printer.

VBA Copy code Copy code
Public Sub InstalledPrinters_Example()

 Dim pubInstalledPrinters As Publisher.InstalledPrinters
 Dim pubApplication As Publisher.Application
 Dim pubPrinter As Publisher.Printer

 Set pubApplication = ThisDocument.Application
 Set pubInstalledPrinters = pubApplication.InstalledPrinters

 For Each pubPrinter In pubInstalledPrinters
 Debug.Print pubPrinter.PrinterName
 If pubPrinter.IsActivePrinter Then
 Debug.Print "This is the active printer."
 End If
 Next

End Sub


Document.Undo Method (Publisher)

 Copy code hover
[image]

Document.Undo Method (Publisher)
Send feedback

Undoes the last action or a specified number of actions. Corresponds to the list of items that appears when you click the arrow beside the Undo button on the Standard toolbar.

Syntax

expression .Undo(Count)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Count | Optional | Long | Specifies the number of actions to be undone. Default is 1, meaning that if omitted, only the last action will be undone.

Remarks

If called when there are no actions on the undo stack, or when Count is greater than the number of actions that currently reside on the stack, the Undo method will undo as many actions as possible and ignore the rest.

The maximum number of actions that can be undone in one call to Undo is 20.

Example

The following example uses the Undo method to undo actions that do not meet specific criteria.

Part 1 of the example adds a rectangular callout shape to the fourth page of the active publication, and text is added to the callout. This process creates three actions.

Part 2 of the example tests whether the font of the text added to the callout is Verdana. If not, then the Undo method is used to undo all available actions (the value of the UndoActionsAvailable property is used to specify that all actions be undone). This clears all actions from the stack. A new rectangle shape and text frame are then added and the text frame is populated with Verdana text.

Copy code Copy code
Dim thePage As page
Dim theShape As Shape
Dim theDoc As Publisher.Document

Set theDoc = ActiveDocument
Set thePage = theDoc.Pages(4)

With theDoc
 ' Part 1
 With thePage
 ' Setting the shape creates the first action
 Set theShape = .Shapes.AddShape(msoShapeRectangularCallout, _
 75, 75, 120, 30)
 ' Setting the text range creates the second action
 With theShape.TextFrame.TextRange
 ' Setting the text creates the third action
 .Text = "This text is not Verdana."
 End With
 End With

 ' Part 2
 If Not thePage.Shapes(1).TextFrame.TextRange.Font.Name = "Verdana" Then
 ' UndoActionsAvailable = 3
 .Undo (.UndoActionsAvailable)
 With thePage
 Set theShape = .Shapes.AddShape(msoShapeRectangle, _
 75, 75, 120, 30)
 With theShape.TextFrame.TextRange
 .Font.Name = "Verdana"
 .Text = "This text is Verdana."
 End With
 End With
 End If
End With


FindReplace.FoundTextRange Property (Publisher)

 Copy code hover
[image]

FindReplace.FoundTextRange Property (Publisher)
Send feedback

Returns a TextRange object that represents the found text or replaced text of a find operation. Read-only.

Syntax

expression .FoundTextRange

expression A variable that represents a FindReplace object.

Return Value

TextRange

Remarks

The actual TextRange object returned by the FoundTextRange property is determined by the value of the ReplaceScope property. The following table lists the corresponding values of these properties.

for ReplaceScope = pbReplaceScopeAll | FoundTextRange = Empty
for ReplaceScope = pbReplaceScopeNone | FoundTextRange = Find text range
for ReplaceScope = pbReplaceScopeOne | FoundTextRange = Replace text range

When ReplaceScope is set to pbReplaceScopeAll, the FoundTextRange property is empty. Any attempt to access it returns "Access Denied." The way to manipulate the text range of the searched text is to set the ReplaceScope property to pbReplaceScopeNone or pbReplaceScopeOne and access the text range of the searched or replaced text for each occurrence found.

Example

When ReplaceScope is set to pbReplaceScopeNone, FoundTextRange returns the text range of the searched text. The following example illustrates how the font attributes of the find text range can be accessed when ReplaceScope is set to pbReplaceScopeNone.

Copy code Copy code
With TextRange.Find
 .Clear
 .FindText = "important"
 .ReplaceScope = pbReplaceScopeNone
 Do While .Execute = True
 'The FoundTextRange contains the word "important".
 If .FoundTextRange.Font.Italic = msoFalse Then
 .FoundTextRange.Font.Italic = msoTrue
 End If
 Loop
End With

When ReplaceScope is set to pbReplaceScopeOne, the text range of the searched text is replaced. Therefore, the FoundTextRange property returns the text range of the replacement text. The following example demonstrates how the font attributes of the replaced text range can be accessed when ReplaceScope is set to pbReplaceScopeOne.

Copy code Copy code
With Document.Find
 .Clear
 .FindText = "important"
 .ReplaceWithText = "urgent"
 .ReplaceScope = pbReplaceScopeOne
 Do While .Execute = True
 'The FoundTextRange contains the word "urgent".
 If .FoundTextRange.Font.Bold = msoFalse Then
 .FoundTextRange.Font.Bold = msoTrue
 End If
 Loop
End With

This example replaces each example of the word "bizarre" with the word "strange" and applies italic formatting and bold formatting to the replaced text.

Copy code Copy code
Dim objDocument As Document

Set objDocument = ActiveDocument
With objDocument.Find
 .Clear
 .FindText = "bizarre"
 .ReplaceWithText = "strange"
 .ReplaceScope = pbReplaceScopeOne
 Do While .Execute = True
 .FoundTextRange.Font.Italic = msoTrue
 .FoundTextRange.Font.Bold = msoTrue
 Loop
End With

This example finds all occurrences of the word "important" and applies italic formatting to it.

Copy code Copy code
Dim objTextRange As TextRange

Set objTextRange = ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange
With objTextRange.Find
 .Clear
 .FindText = "important"
 .ReplaceScope = pbReplaceScopeNone
 Do While .Execute = True
 .FoundTextRange.Font.Italic = msoTrue
 Loop
End With


Wizard Properties (Publisher)

 Copy code hover
[image]

Wizard Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
ID | Returns a Long that represents the type of a shape, range of shapes, or property, type, or value of a wizard. Read-only.
Name | Returns a String value indicating the name of the specified object. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Properties | Returns a WizardProperties collection representing all the settings that are part of the specified publication design or Design Gallery object's wizard.


TextStyle Properties (Publisher)

 Copy code hover
[image]

TextStyle Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
BaseStyle | Returns or sets a String that represents the style upon which the formatting of another style is based. Read/write.
Description | Returns a String that represents the description of the specified style. For example, a typical description for the Normal style might be "(Default) Times New Roman, (Asian) MS Mincho, 10 pt, Main (Black), Kerning 14 pt, Left, Line spacing 1 sp." Read-only.
Font | Sets or returns a Font object that represents character formatting attributes applied to the specified object. Read/write.
Name | Returns a String value indicating the name of the specified object. Read-only.
NextParagraphStyle | Returns or sets a String that represents the paragraph style that follows the specified text style when a user presses ENTER. Read/write.
ParagraphFormat | Returns a ParagraphFormat object representing the paragraph formatting for the specified text range or text style.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Plate.Luminance Property (Publisher)

 Copy code hover
[image]

Plate.Luminance Property (Publisher)
Send feedback

Returns or sets a Long indicating a calculated luminance value for the specified plate; used for spot-color trapping. Valid values are from 0 to 100. Read/write.

Syntax

expression .Luminance

expression A variable that represents a Plate object.

Return Value

Long

Remarks

This property is valid only for publications with a ColorMode property value of pbColorModeSpot or for spot plates in a publication with a ColorMode property value of pbColorModeSpotAndProcess.

Example

The following example loops through all the spot-color plates in a publication and reports their luminance values.

Copy code Copy code
Dim plaTemp As Plates
Dim plaLoop As Plate

Set plaTemp = ActiveDocument.Plates

If ActiveDocument.ColorMode <> pbColorModeSpot And _
 ActiveDocument.ColorMode <> pbColorModeSpotAndProcess Then
 Debug.Print "No spot colors in this publication."
Else
 For Each plaLoop In plaTemp
 With plaLoop
 Debug.Print "Plate " & .Name _
 & " has a luminance of " & .Luminance
 End With
 Next plaLoop
End If


Hyperlinks.Item Property (Publisher)

 Copy code hover
[image]

Hyperlinks.Item Property (Publisher)
Send feedback

Returns an individual object from a specified collection. Read-only.

Syntax

expression .Item(Index)

expression A variable that represents a Hyperlinks object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The number of the object to return.

Example

This example displays the address of the first hyperlink in shape one of the active publication.

VBA Copy code Copy code
MsgBox "Address of first hyperlink: " _
 & ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.Hyperlinks.Item(1).Address


Window.Left Property (Publisher)

 Copy code hover
[image]

Window.Left Property (Publisher)
Send feedback

Returns or sets a Long indicating the position (in points) of the left edge of the application window relative to the left edge of the screen. Read/write.

Syntax

expression .Left

expression A variable that represents a Window object.

Example

This example sets the horizontal position of the active window to 100 points.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow
 .WindowState = pbWindowStateNormal
 .Left = 100
 .Top = 0
End With


Tags.Parent Property (Publisher)

 Copy code hover
[image]

Tags.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a Tags object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


ShapeRange.Width Property (Publisher)

 Copy code hover
[image]

ShapeRange.Width Property (Publisher)
Send feedback

Returns a Variant that represents the width (in points) of a specified range of shapes. Read-only.

Syntax

expression .Width

expression A variable that represents a ShapeRange object.


TextEffectFormat.FontSize Property (Publisher)

 Copy code hover
[image]

TextEffectFormat.FontSize Property (Publisher)
Send feedback

Returns or sets a Variant that represents the font size for the specified WordArt, in points. Read/write.

Syntax

expression .FontSize

expression A variable that represents a TextEffectFormat object.


WebPageOptions.Keywords Property (Publisher)

 Copy code hover
[image]

WebPageOptions.Keywords Property (Publisher)
Send feedback

Returns or sets a String that represents the keywords for a Web page within a Web publication. Read/write.

Syntax

expression .Keywords

expression A variable that represents a WebPageOptions object.

Return Value

String

Example

The following example sets the keywords for page four of the active publication.

Copy code Copy code
Dim theWPO As WebPageOptions

Set theWPO = ActiveDocument.Pages(4).WebPageOptions

With theWPO
 .Keywords = "software, hardware, computers"
End With


CellRange.Application Property (Publisher)

 Copy code hover
[image]

CellRange.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a CellRange object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


PictureFormat.ColorModel Property (Publisher)

 Copy code hover
[image]

PictureFormat.ColorModel Property (Publisher)
Send feedback

Returns a PbColorModel constant that represents the color model of the picture. Read-only.

Syntax

expression .ColorModel

expression A variable that represents a PictureFormat object.

Return Value

PbColorModel

Remarks

The ColorModel property value can be one of the PbColorModel constants declared in the Microsoft Publisher type library.

Example

The following example returns a list of the pictures with RGB color mode in the active publication.

VBA Copy code Copy code
Sub ListRGBPictures()
Dim pgLoop As Page
Dim shpLoop As Shape

 For Each pgLoop In ActiveDocument.Pages
 For Each shpLoop In pgLoop.Shapes

 If shpLoop.Type = pbPicture Or shpLoop.Type = pbLinkedPicture Then

 With shpLoop.PictureFormat
 If .IsEmpty = msoFalse Then
 If .ColorModel = pbColorModelRGB Then
 Debug.Print .Filename
 End If
 End If
 End With

 End If

 Next shpLoop
 Next pgLoop

End Sub


PbWindowState Enumeration (Publisher)

 Copy code hover
[image]

PbWindowState Enumeration (Publisher)
Send feedback

Indicates the state of the Microsoft Publisher window.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbWindowStateMaximize | 0 | Window is maximized.
pbWindowStateMinimize | 1 | Window is minimized.
pbWindowStateNormal | 2 | Window is neither maximized nor minimized.


LayoutGuides.MirrorGuides Property (Publisher)

 Copy code hover
[image]

LayoutGuides.MirrorGuides Property (Publisher)
Send feedback

Returns or sets a Boolean indicating whether Microsoft Publisher creates mirror guide positions for a book fold publication. True if Publisher creates mirror guide positions for separate left and right pages in a book fold publication; False if the same margin, row, and column guides are applied to all pages in the publication. Read/write.

Syntax

expression .MirrorGuides

expression A variable that represents a LayoutGuides object.

Return Value

Boolean

Remarks

When the MirrorGuides property is True, margin settings apply to right-facing pages and are mirrored for left-facing pages. In addition, when set to True, the MirrorGuides property sets the publication to use two master pages instead of the default of one. The first master page is for all left-facing pages and the second is for all right-facing pages in the publication. For more information, see MasterPages object.

Example

The following example sets Publisher to create mirror guides for a book fold publication and sets the inside and outside margins of each two-page spread. The example sets the left and right margin values for right-facing pages, and Publisher mirrors these values for left-facing pages.

Copy code Copy code
With ActiveDocument.LayoutGuides
 .MirrorGuides = True
 .MarginLeft = 48
 .MarginRight = 96
End With


ParagraphFormat.ListNumberStart Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.ListNumberStart Property (Publisher)
Send feedback

Sets or retrieves a Long that represents the starting number of a list. Read/write.

Syntax

expression .ListNumberStart

expression A variable that represents a ParagraphFormat object.

Return Value

Long

Remarks

Returns an "Access Denied" message if the list is not a numbered list.

Example

This example sets the list type of a ParagraphFormat object to pbListTypeArabic and sets the ListNumber property to 4.

Copy code Copy code
Dim objParaForm As ParagraphFormat

Set objParaForm = ActiveDocument.Pages(1).Shapes(1) _
.TextFrame.TextRange.ParagraphFormat

 With objParaForm
 .SetListType pbListTypeArabic
 .ListNumberStart = 4
 End With

End Sub


Application.MailMergeDataSourceValidate Event (Publisher)

 Copy code hover
[image]

Application.MailMergeDataSourceValidate Event (Publisher)
See also Send feedback

Occurs when a user performs address verification by clicking Validate in the Mail Merge Recipients dialog box.

Syntax

expression .MailMergeDataSourceValidate(Doc, Handled)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The mail merge main document.
Handled | Required | Boolean | True runs the accompanying validation code against the mail merge data source. False cancels the data source validation.

Remarks

If you do not have address verification software installed on your computer, use the MailMergeDataSourceValidate event to create simple filtering routines, such as looping through records to check the postal codes and remove any that are non-U.S. Non-U.S. users can filter out all U.S. postal codes by modifying the code sample below and using Microsoft Visual Basic commands to search for text or special characters.

To access the Application object events, declare an Application object variable in the General Declarations section of a code module. Then set the variable equal to the Application object for which you want to access events. For information about using events with the Microsoft Publisher Application object, see Using Events with the Application Object.

Example

This example validates ZIP Codes in the attached data source for five digits. If the length of the ZIP Code is fewer than five digits, the record is excluded from the mail merge process. This example assumes the postal codes are U.S. ZIP Codes. You could modify this example to search for ZIP Codes that have a four-digit locator code appended to the ZIP Code, and then exclude all records that do not contain the locator code.

Copy code Copy code
Private Sub MailMergeApp_MailMergeDataSourceValidate( _
 ByVal Doc As Document, _
 Handled As Boolean)

 Dim intCount As Integer

 Handled = True

 On Error Resume Next

 With ActiveDocument.MailMerge.DataSource

 'Set the active record equal to the first included record in the
 'data source
 .ActiveRecord = 1
 Do
 intCount = intCount + 1

 'Set the condition that field six must be greater than or
 'equal to five
 If Len(.DataFields.Item(6).Value) < 5 Then

 'Exclude the record if field six is shorter than five digits
 .Included = False

 'Mark the record as containing an invalid address field
 .InvalidAddress = True

 'Specify the comment attached to the record explaining
 'why the record was excluded from the mail merge
 .InvalidComments = "The ZIP Code for this record has " _
 & "fewer than five digits. It will be removed " _
 & "from the mail merge process."

 End If

 'Move the record to the next record in the data source
 .ActiveRecord = .ActiveRecord + 1

 'End the loop when the counter variable
 'equals the number of records in the data source
 Loop Until intCount = .RecordCount
 End With

End Sub

For this event to occur, you must place the following line of code in the General Declarations section of your module and run the following initialization routine.

Copy code Copy code
Private WithEvents MailMergeApp As Application

Sub InitializeMailMergeApp()
 Set MailMergeApp = Publisher.Application
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


CalloutFormat.Accent Property (Publisher)

 Copy code hover
[image]

CalloutFormat.Accent Property (Publisher)
Send feedback

Returns or sets an MsoTriState constant indicating whether a vertical accent bar separates the callout text from the callout line. Read/write.

Syntax

expression .Accent

expression A variable that represents a CalloutFormat object.

Return Value

MsoTriState

Remarks

The Accent property value can be one of these MsoTriState constants.

Constant | Description
msoCTrue | Not used with this property.
msoFalse | A vertical accent bar does not separate the callout text from the callout line.
msoTriStateMixed | Return value only; indicates a combination of msoTrue and msoFalse in the specified shape range.
msoTriStateToggle | Set value only; switches between msoTrue and msoFalse.
msoTrue | A vertical accent bar separates the callout text from the callout line.

Example

This example adds an oval to the active publication and a callout that points to the oval. The callout text will not have a border, but it will have a vertical accent bar that separates the text from the callout line.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes
 ' Add an oval.
 .AddShape Type:=msoShapeOval, _
 Left:=180, Top:=200, Width:=280, Height:=130

 ' Add a callout.
 With .AddCallout(Type:=msoCalloutTwo, _
 Left:=420, Top:=170, Width:=170, Height:=40)

 ' Add text to the callout.
 .TextFrame.TextRange.Text = "This is an oval"

 ' Add an accent bar to the callout.
 With .Callout
 .Accent = msoTrue
 .Border = msoFalse
 End With
 End With
End With


ShapeRange.LockAspectRatio Property (Publisher)

 Copy code hover
[image]

ShapeRange.LockAspectRatio Property (Publisher)
Send feedback

Returns or sets an MsoTriState constant indicating whether the specified shape retains its original proportions when you resize it. Read/write.

Syntax

expression .LockAspectRatio

expression A variable that represents a ShapeRange object.

Remarks

The LockAspectRatio property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The height and width of the shape change independently of one another when you resize it.
msoTriStateMixed | Return value indicating a combination of msoTrue and msoFalse for the specified shape range.
msoTriStateToggle | Set value that switches between msoTrue and msoFalse.
msoTrue | The specified shape retains its original proportions when you resize it.

Example

This example adds a cube to the active publication. The cube can be moved and resized, but not reproportioned.

VBA Copy code Copy code
Dim shp As Shape

Set shp = ActiveDocument.Pages(1).Shapes _
 .AddShape(Type:=msoShapeCube, _
 Left:=50, Top:=50, Width:=100, Height:=200) _

shp.LockAspectRatio = msoTrue


Cell.Application Property (Publisher)

 Copy code hover
[image]

Cell.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a Cell object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


MailMergeDataFields.Application Property (Publisher)

 Copy code hover
[image]

MailMergeDataFields.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a MailMergeDataFields object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


ParagraphFormat.Reset Method (Publisher)

 Copy code hover
[image]

ParagraphFormat.Reset Method (Publisher)
Send feedback

Removes manual paragraph or text formatting from the specified object and leaves only the formatting specified by the current text style.

Syntax

expression .Reset

expression A variable that represents a ParagraphFormat object.

Return Value

Nothing

Example

The following example resets the character formatting of the text in shape one on page one of the active publication to the default character formatting for the current text style.

Copy code Copy code
ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.Font.Reset

The following example resets the paragraph formatting of the text in shape one on page one of the active publication to the default paragraph formatting for the current text style.

Copy code Copy code
ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.ParagraphFormat.Reset


Selection.ChildShapeRange Property (Publisher)

 Copy code hover
[image]

Selection.ChildShapeRange Property (Publisher)
Send feedback

Returns a ShapeRange object representing the child shapes of a selection.

Syntax

expression .ChildShapeRange

expression A variable that represents a Selection object.

Return Value

ShapeRange

Example

This example creates a new page in the active publication, populates the page with shapes, and selects and groups the shapes. Then, after canceling the selection of two of the group shapes, it changes the AutoShape type for one of the shapes.

Copy code Copy code
Sub ChangeFillToChildShape()

 With ThisDocument.Pages(1)
 With .Shapes
 .AddShape msoShape4pointStar, 10, 10, 175, 175
 .AddShape msoShapeOval, 100, 100, 175, 75
 .AddShape msoShapeOval, 150, 150, 175, 75
 .Range.Group
 .SelectAll
 End With
 .Shapes(1).GroupItems(1).Select msoFalse
 .Shapes(1).GroupItems(2).Select msoFalse
 End With

 Selection.ChildShapeRange(3).AutoShapeType = msoShapeDiamond

End Sub


FillFormat.Application Property (Publisher)

 Copy code hover
[image]

FillFormat.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a FillFormat object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


CellRange.Item Method (Publisher)

 Copy code hover
[image]

CellRange.Item Method (Publisher)
Send feedback

Returns an individual Cell object in the specified CellRange collection.

Syntax

expression .Item(Index)

expression A variable that represents a CellRange object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The number of the object to return.

Return Value

Cell

Example

This example returns the first cell from a CellRange collection.

VBA Copy code Copy code
Dim cllTemp As Cell

Set cllTemp = ActiveDocument.Pages(Index:=1).Shapes(1).Table.Cells.Item(Index:=1)


FillFormat.TextureType Property (Publisher)

 Copy code hover
[image]

FillFormat.TextureType Property (Publisher)
Send feedback

Returns an MsoTextureType constant indicating the texture type for the specified fill. Read-only.

Syntax

expression .TextureType

expression A variable that represents a FillFormat object.

Return Value

MsoTextureType

Remarks

This property is read-only. Use the PresetTextured or UserTextured method to set the texture type for the fill.

The property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoTexturePreset | The fill uses a preset texture type.
msoTextureTypeMixed | Indicates a combination of texture types for the specified shape range..
msoTextureUserDefined | The fill uses a user-defined texture type.

Example

This example applies a canvas texture to the fill for all shapes on the first page of the active publication that currently have fills with a user-defined texture.

VBA Copy code Copy code
Dim shpLoop As Shape

For Each shpLoop In ActiveDocument.Pages(1).Shapes
 With shpLoop.Fill
 If .TextureType = msoTextureUserDefined Then
 .PresetTextured _
 PresetTexture:=msoTextureCanvas
 End If
 End With
Next shpLoop


PbPublicationLayout Enumeration (Publisher)

 Copy code hover
[image]

PbPublicationLayout Enumeration (Publisher)
Send feedback

Represents the layout type of the specified publication.

Members

Name | Value | Description
pbLayout4x6BaePan | 10 |
pbLayout4x6BanPan | 12 |
pbLayout4x6Pan | 11 |
pbLayoutAdvertisement | 36 |
pbLayoutAwardCertificate | 37 |
pbLayoutBanner | 38 |
pbLayoutBannerCustom | 27 |
pbLayoutBannerLarge | 26 |
pbLayoutBannerMedium | 25 |
pbLayoutBannerSmall | 24 |
pbLayoutBook | 2 |
pbLayoutBrochure | 39 |
pbLayoutBusinessCard | 40 |
pbLayoutBusinessCardEurope | 18 |
pbLayoutBusinessCardFE | 19 |
pbLayoutBusinessCardLocal | 20 |
pbLayoutBusinessCardUS | 17 |
pbLayoutBusinessForm | 41 |
pbLayoutCalendar | 42 |
pbLayoutCatalog | 43 |
pbLayoutCrownPan | 13 |
pbLayoutCustom | 23 |
pbLayoutEmail | 44 |
pbLayoutEnvelope | 33 |
pbLayoutFlyer | 45 |
pbLayoutFoldCard | 3 |
pbLayoutFullPage | 1 |
pbLayoutGiftCertificate | 46 |
pbLayoutGreetingCard | 47 |
pbLayoutGreetingCardL | 4 |
pbLayoutGreetingCardT | 5 |
pbLayoutIndexCard | 16 |
pbLayoutInvitationCard | 49 |
pbLayoutJang4x6Pan | 15 |
pbLayoutKookBaePan | 6 |
pbLayoutKookBanPan | 9 |
pbLayoutKookPan | 7 |
pbLayoutLabel | 32 |
pbLayoutLetterhead | 50 |
pbLayoutMenu | 51 |
pbLayoutNewsletter | 52 |
pbLayoutPaperFoldingProject | 53 |
pbLayoutPostcard | 54 |
pbLayoutPostcardA4 | 30 |
pbLayoutPostcardHalfLetter | 29 |
pbLayoutPostcardJapan | 31 |
pbLayoutPostcardUS | 28 |
pbLayoutPosterLarge | 22 |
pbLayoutPosterSmall | 21 |
pbLayoutProgram | 55 |
pbLayoutQuickPublication | 60 |
pbLayoutResume | 56 |
pbLayoutShinKookPan | 8 |
pbLayoutShinSeoPan | 14 |
pbLayoutSign | 57 |
pbLayoutWebPageLarge | 35 |
pbLayoutWebPageSmall | 34 |
pbLayoutWebSite | 59 |
pbLayoutWithComplimentsCard | 58 |
pbLayoutWordImport | 48 |


MailMergeFilterCriterion.Parent Property (Publisher)

 Copy code hover
[image]

MailMergeFilterCriterion.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a MailMergeFilterCriterion object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


LineFormat.Parent Property (Publisher)

 Copy code hover
[image]

LineFormat.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a LineFormat object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Page Methods (Publisher)

 Copy code hover
[image]

Page Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified object.
Duplicate | Creates a duplicate of the specified Page object and then returns the new Page object.
ExportEmailHTML | Exports the active page of the publication as an HTML file.
Move | Moves the specified page to the specified index in the Pages collection.
SaveAsPicture | Saves a page as a picture file.


ShapeRange.ScaleWidth Method (Publisher)

 Copy code hover
[image]

ShapeRange.ScaleWidth Method (Publisher)
Send feedback

Scales the width of the shape by a specified factor. For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original size or relative to the current size.

Syntax

expression .ScaleWidth(Factor, RelativeToOriginalSize, fScale)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Factor | Required | Single | Specifies the ratio between the height of the shape after you resize it and the current or original height. For example, to make a rectangle 50 percent larger, specify 1.5 for this argument.
RelativeToOriginalSize | Required | MsoTristate | Specifies whether to scale relative to the object's original or current size.
fScale | Optional | MsoScaleFrom | The part of the shape that retains its position when the shape is scaled.

Return Value

Nothing

Remarks

The RelativeToOriginalSize parameter can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | Scales the shape relative to its current size.
msoTrue | Scales the shape relative to its original size.

The fScale parameter can be one of the MsoScaleFrom constants declared in the Microsoft Office type library and shown in the following table. The default is msoScaleFromTopLeft.

msoScaleFromBottomRight

msoScaleFromMiddle

msoScaleFromTopLeft

Shapes other than pictures and OLE objects are always scaled relative to their current width; specifying a RelativeToOriginalSize value of msoTrue for shapes other than pictures or OLE objects causes an error.

Use the ScaleHeight method to scale the height of a shape.

Example

This example scales all pictures and OLE objects on the first page of the active publication to 175 percent of their original height and width, and it scales all other shapes to 175 percent of their current height and width.

VBA Copy code Copy code
' Looping variable.
Dim shpLoop As Shape

' Loop through all the shapes on the first page.
For Each shpLoop In ActiveDocument.Pages(1).Shapes
 With shpLoop
 Select Case .Type
 ' If the shape is a picture or OLE object,
 ' scale relative to original size.
 Case pbPicture, pbLinkedPicture, _
 pbEmbeddedOLEObject, pbLinkedOLEObject, _
 pbOLEControlObject
 .ScaleHeight Factor:=1.75, _
 RelativeToOriginalSize:=True
 .ScaleWidth Factor:=1.75, _
 RelativeToOriginalSize:=True
 ' If the shape is not a picture or OLE object,
 ' scale relative to the current size.
 Case Else
 .ScaleHeight Factor:=1.75, _
 RelativeToOriginalSize:=False
 .ScaleWidth Factor:=1.75, _
 RelativeToOriginalSize:=False
 End Select
 End With
Next shpLoop


BorderArtFormat.Weight Property (Publisher)

 Copy code hover
[image]

BorderArtFormat.Weight Property (Publisher)
See also Send feedback

Returns or sets a Variant indicating the thickness of the specified line or cell border.

Syntax

expression .Weight

expression A variable that represents a BorderArtFormat object.

Remarks

Return values are in points. When setting the property, numeric values are evaluated in points, and strings can be in any units supported by Publisher (for example, "2.5 in").

Example

This example adds a green dashed line, two points thick, to the active publication.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes _
 .AddLine(BeginX:=10, BeginY:=10, _
 EndX:=250, EndY:=250).Line
 .DashStyle = msoLineDashDotDot
 .ForeColor.RGB = RGB(0, 255, 255)
 .Weight = 2
End With

See also

Concepts

BorderArtFormat Object

Other resources

BorderArtFormat Object Members


Shapes.AddWordArt Method (Publisher)

 Copy code hover
[image]

Shapes.AddWordArt Method (Publisher)
Send feedback

Returns a Shape object that represents the WordArt to be added to the publication.

Version Information

Version Added: Publisher 2010

Syntax

expression .AddWordArt(PresetWordArt, Text, FontName, FontSize, FontBold, FontItalic, Left, Top)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
PresetWordArt | Required | pbPresetWordArt | The type of preset WordArt to add.
Text | Required | String | The text of the WordArt.
FontName | Required | String | The name of the font to be used in the WordArt.
FontSize | Required | Variant | The size of the font to be used in the WordArt.
FontBold | Required | [MSOTRISTATE] | Whether the WordArt text should be bold. See Remarks for possible values.
FontItalic | Required | [MSOTRISTATE] | Whether the WordArt text should be italic. See Remarks for possible values.
Left | Required | Variant | The horizontal position of the WordArt.
Top | Required | Variant | The vertical position of the WordArt.

Return Value

Shape

Remarks

The FontBold parameter value can be one of the following MsoTriState constants declared in the Microsoft Office type library.

Constant | Description
msoFalse | None of the characters in the WordArt are formatted as bold.
msoTriStateMixed | Return value indicating that the WordArt contains some text formatted as bold and some text not formatted as bold.
msoTriStateToggle | Set value that switches between msoTrue and msoFalse.
msoTrue | All characters in the WordArt are formatted as bold.

The FontItalic parameter value can be one of the following MsoTriState constants declared in the Microsoft Office type library.

Constant | Description
msoFalse | None of the characters in the WordArt are formatted as italic.
msoTriStateMixed | Return value indicating that the WordArt contains some text formatted as italic and some text not formatted as italic.
msoTriStateToggle | Set value that switches between msoTrue and msoFalse.
msoTrue | All characters in the WordArt are formatted as italic.


LayoutGuides.VerticalBaseLineOffset Property (Publisher)

 Copy code hover
[image]

LayoutGuides.VerticalBaseLineOffset Property (Publisher)
Send feedback

Returns a Single that represents the vertical baseline offset of the specified LayoutGuides object. Read/write.

Syntax

expression .VerticalBaseLineOffset

expression A variable that represents a LayoutGuides object.

Return Value

Single

Remarks

When setting the layout guide properties of a Page object it must be returned from the MasterPages collection.

Example

This example sets the vertical baseline offset of the layout guides object to 12 for the second master page in the active document.

VBA Copy code Copy code
Dim objLayout As LayoutGuides
Set objLayout = ActiveDocument.MasterPages(2).LayoutGuides
objLayout.VerticalBaseLineOffset = 12


ColorFormat.Parent Property (Publisher)

 Copy code hover
[image]

ColorFormat.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a ColorFormat object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


PictureFormat.HorizontalPictureLocking Property (Publisher)

 Copy code hover
[image]

PictureFormat.HorizontalPictureLocking Property (Publisher)
Send feedback

Returns or sets a PbHorizontalPictureLocking constant indicating where newly inserted pictures appear in relation to the specified frame. Read/write.

Syntax

expression .HorizontalPictureLocking

expression A variable that represents a PictureFormat object.

Return Value

PbHorizontalPictureLocking

Remarks

The HorizontalPictureLocking property value can be one of the PbHorizontalPictureLocking constants declared in the Microsoft Publisher type library.

Example

The following example locks the specified picture to the upper-left corner of the picture frame. Shape one on page one of the active publication must be a picture frame for this example to work.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes(1).PictureFormat
 .HorizontalPictureLocking = pbHorizontalLockingLeft
 .VerticalPictureLocking = pbVerticalLockingTop
End With


Application.PointsToCentimeters Method (Publisher)

 Copy code hover
[image]

Application.PointsToCentimeters Method (Publisher)
See also Send feedback

Converts a measurement from points to centimeters (1 cm = 28.35 points). Returns the converted measurement as a Single.

Syntax

expression .PointsToCentimeters(Value)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Value | Required | Single | The point value to be converted to centimeters.

Return Value

Single

Remarks

Use the CentimetersToPoints method to convert measurements in centimeters to points.

Example

This example converts measurements in points entered by the user to measurements in centimeters.

Copy code Copy code
Dim strInput As String
Dim strOutput As String

Do While True
 ' Get input from user.
 strInput = InputBox( _
 Prompt:="Enter measurement in points (0 to cancel): ", _
 Default:="0")

 ' Exit the loop if user enters zero.
 If Val(strInput) = 0 Then Exit Do

 ' Evaluate and display result.
 strOutput = Trim(strInput) & " points = " _
 & Format(Application _
 .PointsToCentimeters(Value:=Val(strInput)), _
 "0.00") & " cm"

 MsgBox strOutput
Loop

See also

Concepts

Application Object

Other resources

Application Object Members


PbListSeparator Enumeration (Publisher)

 Copy code hover
[image]

PbListSeparator Enumeration (Publisher)
Send feedback

Constants that represent the list separator of the specified paragraphs, passed to and returned by the ParagraphFormat.ListNumberSeparator property.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbListSeparatorColon | 327680 | Colon
pbListSeparatorDoubleHyphen | 458752 | Double Hyphen
pbListSeparatorDoubleParen | 65536 | Double Parenthesis
pbListSeparatorDoubleSquare | 393216 | Double Square
pbListSeparatorParenthesis | 0 | Parenthesis
pbListSeparatorPeriod | 131072 | Period
pbListSeparatorPlain | 196608 | Plain
pbListSeparatorSquare | 262144 | Square
pbListSeparatorWideComma | 524288 | WideComma


Adjustments.Item Property (Publisher)

 Copy code hover
[image]

Adjustments.Item Property (Publisher)
See also Send feedback

Returns or sets a Variant indicating the adjustment value specified by the Index argument. Read/write.

Syntax

expression .Item(Index)

expression A variable that represents an Adjustments object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Integer | The index number of the adjustment.

Remarks

AutoShapes, connectors, and WordArt objects can have up to eight adjustments.

For linear adjustments, an adjustment value of 0.0 generally corresponds to the left or top edge of the shape, and a value of 1.0 generally corresponds to the right or bottom edge of the shape. However, adjustments can pass beyond shape boundaries for some shapes. For radial adjustments, an adjustment value of 1.0 corresponds to the width of the shape. For angular adjustments, the adjustment value is specified in degrees.

The Item property applies only to shapes that have adjustments.

Example

This example adds two crosses to the active publication and then sets the value for adjustment one (the only one for this type of AutoShape) on each cross.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes
 .AddShape(Type:=msoShapeCross, Left:=10, Top:=10, Width:=100, _
 Height:=100).Adjustments.Item(1) = 0.4
 .AddShape(Type:=msoShapeCross, Left:=150, Top:=10, Width:=100, _
 Height:=100).Adjustments.Item(1) = 0.2
End With

This example has the same result as the previous example even though it doesn't explicitly use the Item property.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes
 .AddShape(Type:=msoShapeCross, Left:=10, Top:=10, Width:=100, _
 Height:=100).Adjustments(1) = 0.4
 .AddShape(Type:=msoShapeCross, Left:=150, Top:=10, Width:=100, _
 Height:=100).Adjustments(1) = 0.2
End With

See also

Concepts

Adjustments Object

Other resources

Adjustments Object Members


Cell.Merge Method (Publisher)

 Copy code hover
[image]

Cell.Merge Method (Publisher)
Send feedback

Merges the specified table cell with another cell. The result is a single table cell.

Syntax

expression .Merge(MergeTo)

expression A variable that represents a Cell object.

Parameters

Name | Required/Optional | Data Type | Description
MergeTo | Required | Cell | The cell to be merged with; must be adjacent to the specified cell or an error occurs.

Example

This example merges the first two cells of the first column of the specified table.

VBA Copy code Copy code
Sub MergeCell()
 With ActiveDocument.Pages(1).Shapes(2).Table
 .Rows(1).Cells(1).Merge MergeTo:=.Rows(2).Cells(1)
 End With
End Sub


Document.RedoActionsAvailable Property (Publisher)

 Copy code hover
[image]

Document.RedoActionsAvailable Property (Publisher)
Send feedback

Returns the number of actions available on the redo stack. Read-only Long.

Syntax

expression .RedoActionsAvailable

expression A variable that represents a Document object.

Return Value

Long

Example

The following example adds a rectangle that contains a text frame to the fourth page of the active publication. Some font properties and the text of the text frame are set. A test is then run to determine whether the font in the text frame is Courier. If so, the Undo method is used with the value of the UndoActionsAvailable property passed as a parameter to specify that all previous actions be undone.

The Redo method is then used with the value of the RedoActionsAvailable property minus 2 passed as a parameter to redo all actions except for the last two. A new font is specified for the text in the text frame, in addition to new text.

This example assumes the active document contains at least four pages.

VBA Copy code Copy code
Dim thePage As page
Dim theShape As Shape
Dim theDoc As Publisher.Document

Set theDoc = ActiveDocument
Set thePage = theDoc.Pages(4)

With theDoc
 With thePage
 Set theShape = .Shapes.AddShape(msoShapeRectangle, _
 75, 75, 190, 30)
 With theShape.TextFrame.TextRange
 .Font.Size = 12
 .Font.Name = "Courier"
 .Text = "This font is Courier."
 End With
 End With

 If thePage.Shapes(1).TextFrame.TextRange.Font.Name = "Courier" Then
 ' The Undo method specifies that all undoable actions be undone.
 .Undo (.UndoActionsAvailable)
 ' The Redo method uses RedoActionsAvailable - 2 to specify that
 ' all redoable actions be redone except for the last two actions.
 ' The last two actions that are not redone are setting
 ' .Font.Name and .Text.
 .Redo (.RedoActionsAvailable - 2)
 With theShape.TextFrame.TextRange
 .Font.Name = "Verdana"
 .Text = "This font is Verdana."
 End With
 End If
End With


HeaderFooter.Parent Property (Publisher)

 Copy code hover
[image]

HeaderFooter.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a HeaderFooter object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Page Object (Publisher)

 Copy code hover
[image]

Page Object (Publisher)
Send feedback

Represents a page in a publication. The Pages collection contains all the Page objects in a publication.

Example

Use Pages(index) to return a single Page object. The following example adds new text to the first shape on the first page in the active publication.

Copy code Copy code
Sub AddPageNumberField()
 With ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange
 .InsertAfter " This text is added after the existing text."
 .Font.Size = 15
 End With
End Sub

Use the FindBypageID property to locate a Page object using the application assigned page ID. Use the Add method to create a new page and add it to the publication. The following example adds a new page to the active publication and then looks for that page using the page ID.

Copy code Copy code
Sub FindPage()
 Dim lngPageID As Long

 'Get page ID
 lngPageID = ActiveDocument.Pages.Add(Count:=1, After:=1).PageID

 'Use page ID to add a new shape to the page
 ActiveDocument.Pages.FindByPageID(PageID:=lngPageID) _
 .Shapes.AddShape Type:=msoShape5pointStar, _
 Left:=200, Top:=72, Width:=50, Height:=50

End Sub


Fields.AddPhoneticGuide Method (Publisher)

 Copy code hover
[image]

Fields.AddPhoneticGuide Method (Publisher)
Send feedback

Returns a Field object that represents phonetic text added to the specified range.

Syntax

expression .AddPhoneticGuide(Range, Text, Alignment, Raise, FontName, FontSize)

expression A variable that represents a Fields object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | TextRange | The text in the publication over which the phonetic text is displayed.
Text | Required | String | The phonetic text to add.
Alignment | Optional | PbPhoneticGuideAlignmentType | The alignment of the added phonetic text.
Raise | Optional | Variant | The distance (in points) from the top of the text in the specified range to the top of the phonetic text. If no value is specified, Microsoft Publisher automatically sets the phonetic text at an optimum distance above the specified range.
FontName | Optional | String | The name of the font to use for the phonetic text. If no value is specified, Publisher uses the same font as the text in the specified range.
FontSize | Optional | Variant | The font size to use for the phonetic text. Default is 10 point.

Return Value

Field

Remarks

The Alignment parameter can be one of the PbPhoneticGuideAlignmentType constants declared in the Microsoft Publisher type library and shown in the following table.

Constant | Description
pbPhoneticGuideAlignmentCenter | Centers phonetic text over the specified range.
pbPhoneticGuideAlignmentDefault | Centers phonetic text over the specified range. The default.
pbPhoneticGuideAlignmentLeft | Left-aligns phonetic text with the specified range.
pbPhoneticGuideAlignmentOneTwoOne | Adjusts the inside and outside spacing of the phonetic text in a 1:2:1 ratio.
pbPhoneticGuideAlignmentRight | Right-aligns phonetic text with the specified range.
pbPhoneticGuideAlignmentZeroOneZero | Adjusts the inside and outside spacing of the phonetic text in a 0:1:0 ratio.

Example

This example adds a phonetic guide to the selected phrase "very nice."

Copy code Copy code
Sub PhoneticGuide()
 Selection.TextRange.Fields.AddPhoneticGuide _
 Range:=Selection.TextRange, Text:="ver-E nIs", _
 Alignment:=pbPhoneticGuideAlignmentCenter, _
 Raise:=11, FontSize:=7
End Sub


ConnectorFormat Object (Publisher)

 Copy code hover
[image]

ConnectorFormat Object (Publisher)
Send feedback

Contains properties and methods that apply to connectors. A connector is a line that attaches two other shapes at points called connection sites. If you rearrange shapes that are connected, the geometry of the connector will be automatically adjusted so that the shapes remain connected.

Example

Use the ConnectorFormat property of the Shape object or the ShapeRange collection to return a ConnectorFormat object. Use the BeginConnect and EndConnect methods of the ConnectorFormat object to attach the ends of the connector to other shapes in the publication. Use the RerouteConnections method of the Shape object and ShapeRange collection to automatically find the shortest path between the two shapes connected by the connector. Use the Connector property to see whether a shape is a connector.

Note that you assign a size and a position when you add a connector to the Shapes collection, but the size and position are automatically adjusted when you attach the beginning and end of the connector to other shapes in the collection. Therefore, if you intend to attach a connector to other shapes, the initial size and position you specify are irrelevant. Likewise, you specify which connection sites on a shape to attach the connector to when you attach the connector, but using the RerouteConnections method after the connector is attached may change which connection sites the connector attaches to, making your original choice of connection sites irrelevant.

The following example adds two rectangles to the active publication and connects them with a curved connector.

Copy code Copy code
Dim shpAll As Shapes
Dim firstRect As Shape
Dim secondRect As Shape

Set shpAll = ActiveDocument.Pages(1).Shapes
Set firstRect = shpAll.AddShape(Type:=msoShapeRectangle, _
 Left:=100, Top:=50, Width:=200, Height:=100)
Set secondRect = shpAll.AddShape(Type:=msoShapeRectangle, _
 Left:=300, Top:=300, Width:=200, Height:=100)
Copy code Copy code
With shpAll.AddConnector(Type:=msoConnectorCurve, BeginX:=0, _
 BeginY:=0, EndX:=0, EndY:=0).ConnectorFormat
 .BeginConnect ConnectedShape:=firstRect, ConnectionSite:=1
 .EndConnect ConnectedShape:=secondRect, ConnectionSite:=1
 .Parent.RerouteConnections
End With


Tag.Delete Method (Publisher)

 Copy code hover
[image]

Tag.Delete Method (Publisher)
Send feedback

Deletes the specified object.

Syntax

expression .Delete

expression A variable that represents a Tag object.

Remarks

A run-time error occurs if the specified object does not exist.


Page.SaveAsPicture Method (Publisher)

 Copy code hover
[image]

Page.SaveAsPicture Method (Publisher)
Send feedback

Saves a page as a picture file.

Version Information

Version Added: Publisher 2007

Syntax

expression .SaveAsPicture(Filename, pbResolution)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | The path and file name of the new picture file you want to create. The graphics format the picture is saved in is determined by the file name extension (such as .jpg or .gif) you specify.
pbResolution | Optional | PbPictureResolution | The resolution in which you want the picture to be saved. See Remarks for possible values.

Remarks

Possible values for the pbResolution parameter are declared in the PbPictureResolution enumeration in the Microsoft Publisher type library.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the SaveAsPicture method to save the first page of the active publication as a .jpg picture file.

Before running this code, replace filename.jpg with a valid file name and the path to a folder on your computer where you have permission to save files.

VBA Copy code Copy code
Public Sub SaveAsPicture_Example()

 ThisDocument.Pages(1).SaveAsPicture "filename.jpg"

End Sub


PictureFormat.Application Property (Publisher)

 Copy code hover
[image]

PictureFormat.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a PictureFormat object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


ShadowFormat.Obscured Property (Publisher)

 Copy code hover
[image]

ShadowFormat.Obscured Property (Publisher)
Send feedback

Returns or sets an MsoTriState value indicating whether the shadow of the specified shape appears filled in and is obscured by the shape. Read/write.

Syntax

expression .Obscured

expression A variable that represents an ShadowFormat object.

Return Value

MsoTriState

Remarks

The Obscured property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The shadow of the specified shape does not appear filled in and is not obscured by the shape if the shape has no fill.
msoTriStateMixed | Return value indicating a combination of msoTrue and msoFalse for the specified shape range.
msoTriStateToggle | Set value that switches between msoTrue and msoFalse.
msoTrue | The shadow of the specified shape does not appear filled in and is not obscured by the shape if the shape has no fill.

Example

This example sets the horizontal and vertical offsets of the shadow for shape three on page one of the active publication. The shadow is offset 5 points to the right of the shape and 3 points above it. If the shape does not already have a shadow, this example adds one to it. The shadow will be filled in and obscured by the shape, even if the shape has no fill.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes(3).Shadow
 .Visible = True
 .OffsetX = 5
 .OffsetY = -3
 .Obscured = msoTrue
End With


Window.Activate Method (Publisher)

 Copy code hover
[image]

Window.Activate Method (Publisher)
Send feedback

Activates a window or OLE object.

Syntax

expression .Activate

expression A variable that represents a Window object.

Return Value

Nothing

Remarks

Because Publisher runs in a single window, using the Activate method with a Window object makes Publisher the active application.

Example

The following example makes Publisher the active application.

VBA Copy code Copy code
Application.ActiveWindow.Activate

The following example adds an Excel spreadsheet to the first page of the active publication and activates the spreadsheet for editing.

VBA Copy code Copy code
Dim shpSheet As Shape

Set shpSheet = ActiveDocument.Pages(1).Shapes.AddOLEObject _
 (Left:=72, Top:=72, ClassName:="Excel.Sheet")

shpSheet.OLEFormat.Activate


Application.NewDocument Method (Publisher)

 Copy code hover
[image]

Application.NewDocument Method (Publisher)
See also Send feedback

Returns a Document object that represents a new publication.

Syntax

expression .NewDocument(Wizard, Design)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Wizard | Optional | PbWizard | The wizard to use to create the new publication.
Design | Optional | Long | The design to apply to the new publication.

Return Value

Document

Remarks

The Wizard parameter can be one of the PbWizard constants declared in the Microsoft Publisher type library and shown in the following table. The default is pbWizardNone.

pbWizardAdvertisements

pbWizardAirplanes

pbWizardBanners

pbWizardBrochures

pbWizardBusinessCards

pbWizardBusinessForms

pbWizardCalendars

pbWizardCatalogs

pbWizardCertificates

pbWizardEnvelopes

pbWizardFlyers

pbWizardGiftCertificates

pbWizardGreetingCards

pbWizardInvitations

pbWizardJapaneseAdvertisements

pbWizardJapaneseAirplanes

pbWizardJapaneseBanners

pbWizardJapaneseBrochures

pbWizardJapaneseBusinessCards

pbWizardJapaneseBusinessForms

pbWizardJapaneseCalendars

pbWizardJapaneseCatalogs

pbWizardJapaneseCertificates

pbWizardJapaneseEnvelopes

pbWizardJapaneseFlyers

pbWizardJapaneseGiftCertificates

pbWizardJapaneseGreetingCards

pbWizardJapaneseInvitations

pbWizardJapaneseLabels

pbWizardJapaneseLetterheads

pbWizardJapaneseMenus

pbWizardJapaneseNewsletters

pbWizardJapaneseOrigami

pbWizardJapanesePostcards

pbWizardJapanesePrograms

pbWizardJapaneseSigns

pbWizardJapaneseWebSites

pbWizardLabels

pbWizardLetterheads

pbWizardMenus

pbWizardNewsletters

pbWizardNone

pbWizardOrigami

pbWizardPostcards

pbWizardPrograms

pbWizardQuickPublications

pbWizardResumes

pbWizardSigns

pbWizardWebSites

pbWizardWithComplimentsCards

pbWizardWordDocument

Example

This example creates a new publication and edits the master page to contain a page number in a star in the upper-left corner of the page.

VBA Copy code Copy code
Sub CreateNewPublication()
 Dim AppPub As Application
 Dim DocPub As Document

 Set AppPub = New Publisher.Application
 Set DocPub = AppPub.NewDocument
 AppPub.ActiveWindow.Visible = True

 With DocPub.MasterPages(1).Shapes.AddShape _
 (Type:=msoShape5pointStar, Left:=36, _
 Top:=36, Width:=50, Height:=50)
 .Fill.ForeColor.RGB = RGB(Red:=255, Green:=0, Blue:=0)
 With .TextFrame.TextRange
 .InsertPageNumber
 .ParagraphFormat.Alignment = pbParagraphAlignmentCenter
 With .Font
 .Bold = msoTrue
 .Color.RGB = RGB(Red:=255, Green:=255, Blue:=255)
 .Size = 12
 End With
 End With
 End With
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


ShapeRange.Top Property (Publisher)

 Copy code hover
[image]

ShapeRange.Top Property (Publisher)
Send feedback

Returns a Variant that represents the distance between the top of the page and the top shape in a range of shapes. Read-only.

Syntax

expression .Top

expression A variable that represents a ShapeRange object.


ColorCMYK.SetCMYK Method (Publisher)

 Copy code hover
[image]

ColorCMYK.SetCMYK Method (Publisher)
Send feedback

Sets a cyan-magenta-yellow-black (CMYK) color value.

Syntax

expression .SetCMYK(Cyan, Magenta, Yellow, Black)

expression A variable that represents a ColorCMYK object.

Parameters

Name | Required/Optional | Data Type | Description
Cyan | Required | Long | A number that represents the cyan component of the color. Value can be any number between 0 and 255.
Magenta | Required | Long | A number that represents the magenta component of the color. Value can be any number between 0 and 255.
Yellow | Required | Long | A number that represents the yellow component of the color. Value can be any number between 0 and 255.
Black | Required | Long | A number that represents the black component of the color. Value can be any number between 0 and 255.

Example

This example sets the CMYK color for the specified shape.

Copy code Copy code
Sub SetCMYKColor()
 Dim shpStar As Shape

 Set shpStar = ActiveDocument.Pages(1).Shapes _
 .AddShape(Type:=msoShape5pointStar, Left:=72, _
 Top:=72, Width:=150, Height:=150)
 shpStar.Fill.ForeColor.CMYK.SetCMYK Cyan:=0, _
 Magenta:=255, Yellow:=255, Black:=50
End Sub


pbCatalogMergeFieldType Enumeration (Publisher)

 Copy code hover
[image]

pbCatalogMergeFieldType Enumeration (Publisher)
Send feedback

Represents the type of catalog merge field.

Version Information

Version Added: Publisher 2010

Name | Value | Description
pbCatalogMergeFieldTypeText | 0 | Text field.
pbCatalogMergeFieldTypePicture | 1 | Picture field.


Application.PointsToPixels Method (Publisher)

 Copy code hover
[image]

Application.PointsToPixels Method (Publisher)
See also Send feedback

Converts a measurement from points to pixels (1 pixel = 0.75 points). Returns the converted measurement as a Single.

Syntax

expression .PointsToPixels(Value)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Value | Required | Single | The point value to be converted to pixels.

Return Value

Single

Remarks

Use the PixelsToPoints method to convert measurements in pixels to points.

Example

This example converts measurements in points entered by the user to measurements in pixels.

Copy code Copy code
Dim strInput As String
Dim strOutput As String

Do While True
 ' Get input from user.
 strInput = InputBox( _
 Prompt:="Enter measurement in points (0 to cancel): ", _
 Default:="0")

 ' Exit the loop if user enters zero.
 If Val(strInput) = 0 Then Exit Do

 ' Evaluate and display result.
 strOutput = Trim(strInput) & " points = " _
 & Format(Application _
 .PointsToPixels(Value:=Val(strInput)), _
 "0.00") & " pixels"

 MsgBox strOutput
Loop

See also

Concepts

Application Object

Other resources

Application Object Members


Options.AddHebDoubleQuote Property (Publisher)

 Copy code hover
[image]

Options.AddHebDoubleQuote Property (Publisher)
Send feedback

True for Microsoft Publisher to display double quotes for Hebrew alphabet numbering. Default is False. Read/write Boolean.

Syntax

expression .AddHebDoubleQuote

expression A variable that represents an Options object.

Return Value

Boolean

Remarks

This property is accessible only if Hebrew is enabled for Microsoft Office on your computer.

This property applies only to Hebrew alphabet numbering.

As with all the properties of the Options object, the current value of the AddHebDoubleQuote property becomes the default setting applied to all new publications.

This property corresponds to the Add double quotes for Hebrew alphabet numbering check box on the Bullets and Numbering dialog box.

Example

The following example sets Publisher to display double quotes for Hebrew alphabet numbering.

Copy code Copy code
Publisher.Options.AddHebDoubleQuote = True


LineFormat Object (Publisher)

 Copy code hover
[image]

LineFormat Object (Publisher)
Send feedback

Represents line and arrowhead formatting. For a line, the LineFormat object contains formatting information for the line itself; for a shape with a border, this object contains formatting information for the shape's border.

Example

Use the Line property to return a LineFormat object. The following example adds a blue, dashed line to the active document. There is a short, narrow oval at the line's starting point and a long, wide triangle at its endpoint.

Copy code Copy code
Sub FormatLine()
 With ActiveDocument.Pages(1).Shapes.AddLine(BeginX:=100, _
 BeginY:=100, EndX:=200, EndY:=300).Line
 .DashStyle = msoLineDashDotDot
 .ForeColor.RGB = RGB(50, 0, 128)
 .BeginArrowheadLength = msoArrowheadShort
 .BeginArrowheadStyle = msoArrowheadOval
 .BeginArrowheadWidth = msoArrowheadNarrow
 .EndArrowheadLength = msoArrowheadLong
 .EndArrowheadStyle = msoArrowheadTriangle
 .EndArrowheadWidth = msoArrowheadWide
 End With
End Sub


Page.IsWizardPage Property (Publisher)

 Copy code hover
[image]

Page.IsWizardPage Property (Publisher)
Send feedback

Returns True if the specified page is a Microsoft Publisher wizard page. Read-only Boolean.

Syntax

expression .IsWizardPage

expression A variable that represents an Page object.

Return Value

Boolean

Remarks

Wizard pages are special page types for certain types of Publisher wizards (such as Newsletters, Catalogs, and Web Wizards) that can be inserted into a publication.

Use the Wizard property of the Page object to access the wizard for the specified page.

Example

The following example tests to determine whether the specified page is a wizard page. If it is, certain wizard properties are returned.

Copy code Copy code
 With ActiveDocument.Pages(1)
 If .IsWizardPage = True Then

 With .Wizard
 Debug.Print .Name
 Debug.Print .Properties(1).Name
 Debug.Print .Properties(1).CurrentValueId
 End With

 End If
 End With


WebCommandButton.Parent Property (Publisher)

 Copy code hover
[image]

WebCommandButton.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a WebCommandButton object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Window.Parent Property (Publisher)

 Copy code hover
[image]

Window.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a Window object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


FillFormat.Visible Property (Publisher)

 Copy code hover
[image]

FillFormat.Visible Property (Publisher)
Send feedback

Returns or sets an MsoTriState constant indicating whether the specified object or the formatting applied to the specified object is visible. Read/write.

Syntax

expression .Visible

expression A variable that represents a FillFormat object.

Remarks

The Visible property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The specified object or formatting is not visible.
msoTriStateMixed | Return value only. The specified shape range contains both objects with visible formatting and objects with invisible formatting.
msoTriStateToggle | Set value only. Switches the specified object between visible and invisble.
msoTrue | The specified object or formatting is visible.

Example

This example sets the horizontal and vertical offsets for the shadow of shape three on the first page in the active publication. The shadow is offset 5 points to the right of the shape and 3 points above it. If the shape does not already have a shadow, this example adds one to it.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes(3).Shadow
 .Visible = msoTrue
 .OffsetX = 5
 .OffsetY = -3
End With


WebCommandButton.ButtonType Property (Publisher)

 Copy code hover
[image]

WebCommandButton.ButtonType Property (Publisher)
Send feedback

Returns or sets a PbCommandButtonType constant that indicates whether a Web command button will clear or submit form data. Read/write.

Syntax

expression .ButtonType

expression A variable that represents a WebCommandButton object.

Return Value

PbCommandButtonType

Remarks

The ButtonType property value can be one of the PbCommandButtonType constants declared in the Microsoft Publisher type library.

Example

This example creates a new Web command submit button, assigns text to appear on its face, and specifies an e-mail address to which to send the form data.

Copy code Copy code
Sub NewWebForm()
 With ActiveDocument.Pages.Add(Count:=1, After:=1)
 With .Shapes.AddWebControl(Type:=pbWebControlCommandButton, _
 Left:=72, Top:=72, Width:=72, Height:=36)
 With .WebCommandButton
 .ButtonType = pbCommandButtonSubmit
 .ButtonText = "Send Form:"
 .EmailAddress = "someone@example.com"
 End With
 End With
 End With
End Sub


SoftEdgeFormat Members (Publisher)

 Copy code hover
[image]

SoftEdgeFormat Members (Publisher)
Send feedback

Represents the soft edge formatting for a shape or range of shapes.

Properties

Name | Description
Radius | Returns or sets a Single that represents the length of the radius for a soft edge effect. Read/write.
Type | Returns or sets a Single that represents the length of the radius for a soft edge effect. Read/write.
Visible | True if the specified object, or the formatting applied to it, is visible. Read/write MsoTriState.


MailMergeDataField.Value Property (Publisher)

 Copy code hover
[image]

MailMergeDataField.Value Property (Publisher)
Send feedback

Returns a String that represents the value of a mail merge data field record or a mapped data field. Read-only.

Syntax

expression .Value

expression A variable that represents a MailMergeDataField object.


Printer.PrintableRect Property (Publisher)

 Copy code hover
[image]

Printer.PrintableRect Property (Publisher)
Send feedback

Returns a PrintableRect object that represents the printer sheet area within which the specified printer will print. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .PrintableRect

expression A variable that represents a Printer object.

Return Value

PrintableRect

Remarks

The printable rectangle is determined by the printer based on the sheet size specified. The printable rectangle of the printer sheet should not be confused with the area within the margins of the publication page. The printable rectangle might be larger or smaller than the publication page.

Note Note

When the printer sheet and the publication page size are identical, the publication page is centered on the printer sheet and none of the printer's marks print, even if they are selected.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the PrintableRect property to get the boundaries of the printable rectangle for the printer sheet of the active printer.

VBA Copy code Copy code
Public Sub PrintableRect_Example()

 Dim pubInstalledPrinters As Publisher.InstalledPrinters
 Dim pubApplication As Publisher.Application
 Dim pubPrinter As Publisher.Printer

 Set pubApplication = ThisDocument.Application
 Set pubInstalledPrinters = pubApplication.InstalledPrinters

 For Each pubPrinter In pubInstalledPrinters
 If pubPrinter.IsActivePrinter Then
 With pubPrinter.PrintableRect
 Debug.Print "Printable area is " & PointsToInches(.Width) & " by " & PointsToInches(.Height) & " inches."
 Debug.Print "Left Boundary: " & PointsToInches(.Left) & " inches (from left)."
 Debug.Print "Right Boundary: " & PointsToInches(.Left + .Width) & " inches (from left)."
 Debug.Print "Top Boundary: " & PointsToInches(.Top) & " inches(from top)."
 Debug.Print "Bottom Boundary: " & PointsToInches(.Top + .Height) & " inches (from top)."
 End With
 End If
 Next

End Sub


LayoutGuides.MarginBottom Property (Publisher)

 Copy code hover
[image]

LayoutGuides.MarginBottom Property (Publisher)
Send feedback

Returns or sets a Variant that represents the amount of space (in points) between the text and the bottom edge of a cell, text frame, or page. Read/write.

Syntax

expression .MarginBottom

expression A variable that represents a LayoutGuides object.

Example

This example sets the margins of the active publication to two inches.

Copy code Copy code
Sub SetPageMargins()

 With ActiveDocument.LayoutGuides
 .MarginTop = Application.InchesToPoints(Value:=2)
 .MarginBottom = Application.InchesToPoints(Value:=2)
 .MarginLeft = Application.InchesToPoints(Value:=2)
 .MarginRight = Application.InchesToPoints(Value:=2)
 End With

End Sub


WizardProperties.FindPropertyById Method (Publisher)

 Copy code hover
[image]

WizardProperties.FindPropertyById Method (Publisher)
Send feedback

Returns a WizardProperty object, based on the specified ID, from the collection of wizard properties associated with a publication design or a Design Gallery object's wizard.

Syntax

expression .FindPropertyById(ID)

expression A variable that represents a WizardProperties object.

Parameters

Name | Required/Optional | Data Type | Description
ID | Required | Long | The ID of the the wizard property to return; corresponds to the ID property of the WizardProperty object.

Return Value

WizardProperty

Example

The following example changes the settings of the current publication design (Newsletter Wizard) so that the publication has a region dedicated to the customer's address (Customer Address).

Copy code Copy code
Sub SetWizardProperties
 Dim wizTemp As Wizard
 Dim wizproTemp As WizardProperty

 Set wizTemp = ActiveDocument.Wizard

 With wizTemp.Properties
 Set wizproTemp = .FindPropertyById(ID:=901)
 wizproTemp.CurrentValueId = 1
 End With

End Sub


Table.Application Property (Publisher)

 Copy code hover
[image]

Table.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a Table object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Table Object (Publisher)

 Copy code hover
[image]

Table Object (Publisher)
Send feedback

Represents a single table.

Example

Use the Table property to return a Table object. The following example selects the specified table in the active publication.

Copy code Copy code
Sub SelectTable()
 With ActiveDocument.Pages(1).Shapes(1)
 If .Type = pbTable Then _
 .Table.Cells.Select
 End With
End Sub

Use the AddTable method to add a Shape object representing a table at the specified range. The following example adds a 5x5 table on the first page of the active publication, and then selects the first column of the new table.

Copy code Copy code
Sub NewTable()
 With ActiveDocument.Pages(1).Shapes.AddTable(NumRows:=5, NumColumns:=5, _
 Left:=72, Top:=300, Width:=400, Height:=100)
 .Table.Columns(1).Cells.Select
 End With
End Sub


MailMergeDataSources Members (Publisher)

 Copy code hover
[image]

MailMergeDataSources Members (Publisher)
Send feedback

Represents the collection of all MailMergeDataSource objects in the active Microsoft Publisher document, each of which represents one of the data sources in a mail merge operation.

Methods

Name | Description
Item | Returns the MailMergeDataSource object at the specified index position in the MailMergeDataSources collection.

Properties

Name | Description
Application | Returns an Application object that represents the creator of the parent MailMergeDataSources collection. Read-only.
Count | Returns the number of MailMergeDataSource objects in the MailMergeDataSources collection of the active document. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the MailMergeDataSources object was created. Read-only.
Parent | Returns the parent of the MailMergeDataSources collection. Read-only.


WebHiddenFields.Name Method (Publisher)

 Copy code hover
[image]

WebHiddenFields.Name Method (Publisher)
Send feedback

Returns a String that represents the name of a hidden Web field for a Web command button.

Syntax

expression .Name(Index)

expression A variable that represents a WebHiddenFields object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The index number of the hidden field.

Return Value

String

Example

This example creates a Web command button with a hidden field, then displays the field's name.

Copy code Copy code
Sub GetHiddenWebFieldName()
 With ActiveDocument.Pages(1).Shapes.AddWebControl _
 (Type:=pbWebControlCommandButton, _
 Left:=100, Top:=100, Width:=100, _
 Height:=36).WebCommandButton.HiddenFields
 .Add Name:="User", Value:="Power"
 MsgBox "The name of the first hidden field is " & .Name(1)
 End With
End Sub


Shape.GetWidth Method (Publisher)

 Copy code hover
[image]

Shape.GetWidth Method (Publisher)
Send feedback

Returns the width of the shape or shape range as a Single in the specified units.

Syntax

expression .GetWidth(Unit)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Required | PbUnitType | The units in which to return the width.

Return Value

Single

Remarks

The Unit parameter can be one of the PbUnitType constants declared in the Microsoft Publisher type library.

Use the GetHeight method to return the height of a shape or shape range.

Example

The following example displays the height and width in inches (to the nearest hundredth) of the shape range consisting of all the shapes on the first page of the active publication.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes.Range
 MsgBox "Height of all shapes: " _
 & Format(.GetHeight(Unit:=pbUnitInch), "0.00") _
 & " in" & vbCr _
 & "Width of all shapes: " _
 & Format(.GetWidth(Unit:=pbUnitInch), "0.00") _
 & " in"
End With


CaptionStyle Properties (Publisher)

 Copy code hover
[image]

CaptionStyle Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Microsoft Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Name | A string that represents the name of the caption style. Read-only.
Parent | Returns the parent of the CaptionStyle object. Read-only.


Cell.Column Property (Publisher)

 Copy code hover
[image]

Cell.Column Property (Publisher)
Send feedback

Returns a Long that represents the table column containing the specified cell. Read-only.

Syntax

expression .Column

expression A variable that represents a Cell object.

Example

This example adds a page to the active publication, creates a table on that new page, and diagonally splits all cells in even-numbered columns.

VBA Copy code Copy code
Sub CreateNewTable()

 Dim pgeNew As Page
 Dim shpTable As Shape
 Dim tblNew As Table
 Dim celTable As Cell
 Dim rowTable As Row

 'Creates a new document with a five-row by five-column table
 Set pgeNew = ActiveDocument.Pages.Add(Count:=1, After:=1)
 Set shpTable = pgeNew.Shapes.AddTable(NumRows:=5, NumColumns:=5, _
 Left:=72, Top:=72, Width:=468, Height:=100)
 Set tblNew = shpTable.Table

 'Inserts a diagonal split into all cells in even-numbered columns
 For Each rowTable In tblNew.Rows
 For Each celTable In rowTable.Cells
 If celTable.Column Mod 2 = 0 Then
 celTable.Diagonal = pbTableCellDiagonalUp
 End If
 Next celTable
 Next rowTable

End Sub


TextEffectFormat.Tracking Property (Publisher)

 Copy code hover
[image]

TextEffectFormat.Tracking Property (Publisher)
Send feedback

Returns or sets a Variant indicating the tracking value used to display space between the characters in the specified text range. Read/write.

Syntax

expression .Tracking

expression A variable that represents a TextEffectFormat object.

Remarks

Valid range is a float value between 0.0 and 5.0 points. Setting the property to 0.0 disables tracking. Indeterminate values are returned as -2.

Example

This example disables tracking in the second story by setting the Tracking property to zero.

Copy code Copy code
Sub DisableTracking()

 Application.ActiveDocument.Stories(2).TextRange.Font.Tracking = 0.0

End Sub


CatalogMergeShapes.Parent Property (Publisher)

 Copy code hover
[image]

CatalogMergeShapes.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a CatalogMergeShapes object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Document.Sections Property (Publisher)

 Copy code hover
[image]

Document.Sections Property (Publisher)
Send feedback

Returns a Sections object representing a collection of Section objects in the specified document. Read-only Sections.

Syntax

expression .Sections

expression A variable that represents a Document object.

Return Value

Sections

Example

This example sets an object variable to the Sections object of the active document and adds a new section starting at the second page of the publication. This example assumes that there are at least two pages in the publication.

VBA Copy code Copy code
Dim objSections As Sections
Set objSections = ActiveDocument.Sections
objSections.Add StartPageIndex:=2


Document.ReadOnly Property (Publisher)

 Copy code hover
[image]

Document.ReadOnly Property (Publisher)
Send feedback

Returns True if the publication is read-only; returns False if it is read/write. Read-only Boolean.

Syntax

expression .ReadOnly

expression A variable that represents a Document object.

Return Value

Boolean

Example

This example saves the active publication and notifies the user that the file is saved and whether it is read-only.

VBA Copy code Copy code
Sub SaveAndStatus()

 Dim bStatus As Boolean

 Application.ActiveDocument.SaveAs "c:\testfile.pub"
 bStatus = Application.ActiveDocument.ReadOnly
 MsgBox "File Saved and Read-only Status = " & bStatus

End Sub


Page.Duplicate Method (Publisher)

 Copy code hover
[image]

Page.Duplicate Method (Publisher)
Send feedback

Creates a duplicate of the specified Page object and then returns the new Page object.

Syntax

expression .Duplicate

expression A variable that represents a Page object.

Return Value

Page

Example

The following example duplicates the first page in the publication and then sets properties for the duplicate. A shape is then added to the new page and properties are set for the shape.

VBA Copy code Copy code
Dim objPage As Page
Set objPage = ActiveDocument.Pages(1).Duplicate
With objPage
 .Background.Fill.ForeColor.SchemeColor = pbSchemeColorAccent1
 .Shapes.AddShape msoShapeRectangle, 150, 250, 310, 275
 With .Shapes(1)
 .Fill.ForeColor.SchemeColor = pbSchemeColorAccent3
 End With
End With


MailMergeDataSources Object (Publisher)

 Copy code hover
[image]

MailMergeDataSources Object (Publisher)
Send feedback

Represents the collection of all MailMergeDataSource objects in the active Microsoft Publisher document, each of which represents one of the data sources in a mail merge operation.

Version Information

Version Added: Publisher 2007

Remarks

The default member of the MailMergeDataSources collection is the Item method, which returns the MailMergeDataSource object at the index position you specify.

If there is only a single MailMergeDataSource object in the active document, the MailMergeDataSources collection is empty. In that case, if you attempt to get the value of the DataSources property of the MailMergeDataSource object, Publisher returns an error.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to get the names of all the connected data sources in the MailMergeDataSources collection in the active document. It uses the IsDataSourceConnected property of the active document to determine if a data source is connected.

If one or more data sources is connected, the macro uses the Count property of the MailMergeDataSources collection to determine how many data sources are connected.

If just one data source is connected, the macro prints the name of that data source in the Immediate window; if more than one data source is connected, it uses the Item method of the MailMergeDataSources collection to iterate through the collection and the Name property of the MailMergeDataSource object to print the name of each connected data source in the Immediate window.

VBA Copy code Copy code
Public Sub MailMergeDataSources_Example()

 Dim pubMailMergeDataSources As Publisher.MailMergeDataSources
 Dim pubMailMergeDataSource As Publisher.MailMergeDataSource
 Dim lngCount As Long
 Dim intCounter As Integer

 If ThisDocument.IsDataSourceConnected Then

 Set pubMailMergeDataSources = ThisDocument.MailMerge.DataSource.DataSources

 lngCount = pubMailMergeDataSources.Count

 If lngCount > 1 Then

 ' More than one data source is connected.
 For intCounter = 1 To lngCount
 Debug.Print pubMailMergeDataSources.Item(intCounter).Name
 Next

 Else

 ' Only one data source is connected.
 Set pubMailMergeDataSource = ThisDocument.MailMerge.DataSource
 Debug.Print "Only one data source ("; pubMailMergeDataSource.Name; ") is connected!"

 End If

 Else

 Debug.Print "No data sources are connected!"

 End If

End Sub


MailMergeDataSource.MappedDataFields Property (Publisher)

 Copy code hover
[image]

MailMergeDataSource.MappedDataFields Property (Publisher)
Send feedback

Returns a MailMergeMappedDataFields object that represents the mapped data fields available in Microsoft Publisher.

Syntax

expression .MappedDataFields

expression A variable that represents a MailMergeDataSource object.

Return Value

MailMergeMappedDataFields

Example

This example creates a table on a new page of the current publication and lists the mapped data fields available in Publisher and the fields in the data source to which they are mapped. This example assumes that the current publication is a mail merge publication and that the data source fields have corresponding mapped data fields.

VBA Copy code Copy code
Sub MappedFields()
 Dim intCount As Integer
 Dim intRows As Integer
 Dim docPub As Document
 Dim pagNew As Page
 Dim shpTable As Shape
 Dim tblTable As Table
 Dim rowTable As Row

 On Error Resume Next

 Set docPub = ThisDocument
 Set pagNew = ThisDocument.Pages.Add(Count:=1, After:=1)
 intRows = docPub.MailMerge.DataSource.MappedDataFields.Count + 1

 'Creates new table with a heading row
 Set shpTable = pagNew.Shapes.AddTable(NumRows:=intRows, _
 numColumns:=2, Left:=100, Top:=100, Width:=400, Height:=12)
 Set tblTable = shpTable.Table
 With tblTable.Rows(1)
 With .Cells(1).Text
 .Text = "Mapped Data Field"
 .Font.Bold = msoTrue
 End With
 With .Cells(2).Text
 .Text = "Data Source Field"
 .Font.Bold = msoTrue
 End With
 End With

 With docPub.MailMerge.DataSource
 For intCount = 2 To intRows - 1
 'Inserts mapped data field name and the
 'corresponding data source field name
 tblTable.Rows(intCount - 1).Cells(1).Text _
 .Text = .MappedDataFields(Index:=intCount).Name
 tblTable.Rows(intCount - 1).Cells(2).Text _
 .Text = .MappedDataFields(Index:=intCount).DataFieldName
 Next
 End With
End Sub


LineFormat.PresetGradientType Property (Publisher)

 Copy code hover
[image]

LineFormat.PresetGradientType Property (Publisher)
See also Send feedback

Returns the preset gradient type for the specified line. Read-only.

Version Information

Version Added: Publisher 2013

Syntax

expression .PresetGradientType

expression A variable that represents a LineFormat object.

Return value

MsoPresetGradientType

Remarks

Use the PresetGradient method to set the preset gradient type for the fill.

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


ShapeNodes.Delete Method (Publisher)

 Copy code hover
[image]

ShapeNodes.Delete Method (Publisher)
Send feedback

Deletes the specified shape node object.

Syntax

expression .Delete(Index)

expression A variable that represents a ShapeNodes object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | [INT] | Long. The number of the shape node to delete.

Example

This example deletes the first node in the first shape in the active publication.

VBA Copy code Copy code
Sub DeleteNode()
 ActiveDocument.Pages(1).Shapes(1).Nodes.Delete Index:=1
End Sub


Shape.Duplicate Method (Publisher)

 Copy code hover
[image]

Shape.Duplicate Method (Publisher)
Send feedback

Creates a duplicate of the specified Shape or ShapeRange object, adds the new shape or range of shapes to the Shapes collection immediately after the shape or range of shapes specified originally, and then returns the new Shape or ShapeRange object.

Syntax

expression .Duplicate

expression A variable that represents a Shape object.

Return Value

Shape

Example

This example adds a new, blank page at the end of the active publication, adds a diamond shape to the new page, duplicates the diamond, and then sets properties for the duplicate. The first diamond will have the default fill color for the active color scheme; the second diamond will be offset from the first one and will have the first accent color for the active color scheme.

VBA Copy code Copy code
Dim pgTemp As Page
Dim shpTemp As Shape

Set pgTemp = ActiveDocument.Pages.Add(Count:=1, After:=1)
Set shpTemp = pgTemp.Shapes _
 .AddShape(Type:=msoShapeDiamond, _
 Left:=10, Top:=10, Width:=250, Height:=350)

With shpTemp.Duplicate
 .Left = 150
 .Fill.ForeColor.SchemeColor = pbSchemeColorAccent1
End With


Wizard.Properties Property (Publisher)

 Copy code hover
[image]

Wizard.Properties Property (Publisher)
Send feedback

Returns a WizardProperties collection representing all the settings that are part of the specified publication design or Design Gallery object's wizard.

Syntax

expression .Properties

expression A variable that represents a Wizard object.

Return Value

WizardProperties

Example

The following example reports on the publication design associated with the active publication, displaying its name and current settings.

VBA Copy code Copy code
Dim wizTemp As Wizard
Dim wizproTemp As WizardProperty
Dim wizproAll As WizardProperties

Set wizTemp = ActiveDocument.Wizard

With wizTemp
 Set wizproAll = .Properties
 Debug.Print "Publication Design associated with " _
 & "current publication: " _
 & .Name
 For Each wizproTemp In wizproAll
 With wizproTemp
 Debug.Print " Wizard property: " _
 & .Name & " = " & .CurrentValueId
 End With
 Next wizproTemp
End With


WizardProperty Object (Publisher)

 Copy code hover
[image]

WizardProperty Object (Publisher)
Send feedback

Represents a setting that is part of a specific publication design or a Design Gallery object's wizard.

Example

Use the Item property or the FindByPropertyID method with the WizardProperties collection to return a single WizardProperty object. The following example reports on the publication design associated with the active publication, displaying its name and current settings.

Copy code Copy code
Dim wizTemp As Wizard
Dim wizproTemp As WizardProperty
Dim wizproAll As WizardProperties

Set wizTemp = ActiveDocument.Wizard

With wizTemp
 Set wizproAll = .Properties
 Debug.Print "Publication Design associated with " _
 & "current publication: " _
 & .Name
 For Each wizproTemp In wizproAll
 With wizproTemp
 Debug.Print " Wizard property: " _
 & .Name & " = " & .CurrentValueId
 End With
 Next wizproTemp
End With
Note Note

Depending on the language version of Microsoft Publisher that you are using, you may receive an error when using the above code. If this occurs, you will need to build in error handlers to circumvent the errors. For more information, see Wizard Object.


WebNavigationBarSet.Links Property (Publisher)

 Copy code hover
[image]

WebNavigationBarSet.Links Property (Publisher)
Send feedback

Returns a WebNavigationBarHyperlinks collection containing all of the hyperlinks in the specified Web navigation bar set. Read/write.

Syntax

expression .Links

expression A variable that represents a WebNavigationBarSet object.

Return Value

WebNavigationBarHyperlinks

Example

Use the Links property to return a WebNavigationBarHyperlinks property. This example returns the Web navigation bar hyperlinks of the first Web navigation bar set of the active document.

VBA Copy code Copy code
ActiveDocument.WebNavigationBarSets(1).Links

The following example adds a new Web navigation bar set to the active document, adds a hyperlink to the navigation bar, and then adds the navigation bar to every page of the publication that has the AddHyperlinkToWebNavbar property set to True or the Page.WebPageOptions.IncludePageOnNewWebNavigationBars property set to True.

Copy code Copy code
With ActiveDocument.WebNavigationBarSets.AddSet(Name:="WebNavigationBarSet1")
 With .Links
 .Add Address:="www.microsoft.com", TextToDisplay:="Microsoft", Index:=1
 End With
 .AddToEveryPage Left:=10, Top:=10
End With


WebCheckBox.Value Property (Publisher)

 Copy code hover
[image]

WebCheckBox.Value Property (Publisher)
Send feedback

Returns or sets a String that represents the value of a Web check box or option button. Read/write.

Syntax

expression .Value

expression A variable that represents a WebCheckBox object.

Example

This example creates a new Web check box control, assigns a name and value to it, and indicates its initial state is checked.

VBA Copy code Copy code
Sub CreateWebButton()
 With ActiveDocument.Pages(1).Shapes.AddWebControl _
 (Type:=pbWebControlCheckBox, Left:=72, _
 Top:=72, Width:=100, Height:=50)
 .Name = "ControlBox"
 With .WebCheckBox
 .Value = "This is a check box."
 .Selected = msoTrue
 End With
 End With
End Sub


Story.HasTextFrame Property (Publisher)

 Copy code hover
[image]

Story.HasTextFrame Property (Publisher)
Send feedback

Indicates whether the specified shape has a TextFrame object associated with it. Read-only.

Syntax

expression .HasTextFrame

expression A variable that represents a Story object.

Remarks

If the HasTextFrame property is true, clients must check the value of the HasText property of the TextFrame object to determine if there is any text on the shape.

The HasTextFrame property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The specified shape does not have a TextFrame object associated with it.
msoTriStateMixed | Indicates a combination of msoTrue and msoFalse for the specified shape range.
msoTrue | The specified shape has a TextFrame object associated with it.

Example

This example tests all the shapes in the selection and if none have text frames associated with them, they are left aligned.

VBA Copy code Copy code
Sub MoveLeft()

 Dim shpAll As ShapeRange

 Set shpAll = Application.ActiveDocument.Selection.ShapeRange
 If shpAll.HasTextFrame = msoFalse Then
 shpAll.Align msoAlignLefts, msoTrue
 End If

End Sub


TextRange.BoundHeight Property (Publisher)

 Copy code hover
[image]

TextRange.BoundHeight Property (Publisher)
Send feedback

Returns a Single indicating the height, in points, of the bounding box for the specified text range. Read-only.

Syntax

expression .BoundHeight

expression A variable that represents a TextRange object.

Return Value

Single

Example

The following example displays the position, width, and height of the bounding box surrounding the text in the first shape on page one of the active publication.

Copy code Copy code
Dim rngText As TextRange
Dim strMessage As String

Set rngText = ActiveDocument.Pages(1) _
 .Shapes(1).TextFrame.TextRange

With rngText
 strMessage = "Text frame information" & vbCrLf _
 & " Distance from left edge of page: " _
 & .BoundLeft & " points" & vbCrLf _
 & " Distance from top edge of page: " _
 & .BoundTop & " points" & vbCrLf _
 & " Width: " & .BoundWidth & " points" & vbCrLf _
 & " Height: " & .BoundHeight & " points"
End With

MsgBox strMessage


ReaderSpread.Top Property (Publisher)

 Copy code hover
[image]

ReaderSpread.Top Property (Publisher)
Send feedback

Returns the a Single that represents the distance (in points) from the top edge of the workspace to the top edge of the page. Read-only.

Syntax

expression .Top

expression A variable that represents a ReaderSpread object.


FillFormat.Patterned Method (Publisher)

 Copy code hover
[image]

FillFormat.Patterned Method (Publisher)
Send feedback

Sets the specified fill to a pattern.

Syntax

expression .Patterned(Pattern)

expression A variable that represents a FillFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Pattern | Required | MsoPatternType | The pattern to be used for the specified fill.

Remarks

The Pattern parameter can be one of the MsoPatternType constants declared in the Microsoft Office type library and shown in the following table.

msoPattern5Percent

msoPattern10Percent

msoPattern20Percent

msoPattern25Percent

msoPattern30Percent

msoPattern40Percent

msoPattern50Percent

msoPattern60Percent

msoPattern70Percent

msoPattern75Percent

msoPattern80Percent

msoPattern90Percent

msoPatternDarkDownwardDiagonal

msoPatternDarkHorizontal

msoPatternDarkUpwardDiagonal

msoPatternDarkVertical

msoPatternDashedDownwardDiagonal

msoPatternDashedHorizontal

msoPatternDashedUpwardDiagonal

msoPatternDashedVertical

msoPatternDiagonalBrick

msoPatternDivot

msoPatternDottedDiamond

msoPatternDottedGrid

msoPatternHorizontalBrick

msoPatternLargeCheckerBoard

msoPatternLargeConfetti

msoPatternLargeGrid

msoPatternLightDownwardDiagonal

msoPatternLightHorizontal

msoPatternLightUpwardDiagonal

msoPatternLightVertical

msoPatternNarrowHorizontal

msoPatternNarrowVertical

msoPatternOutlinedDiamond

msoPatternPlaid

msoPatternShingle

msoPatternSmallCheckerBoard

msoPatternSmallConfetti

msoPatternSmallGrid

msoPatternSolidDiamond

msoPatternSphere

msoPatternTrellis

msoPatternWave

msoPatternWeave

msoPatternWideDownwardDiagonal

msoPatternWideUpwardDiagonal

msoPatternZigZag

Use the BackColor and ForeColor properties to set the colors used in the pattern.

Example

This example adds an oval with a patterned fill to the active publication.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes _
 .AddShape(Type:=msoShapeOval, _
 Left:=60, Top:=60, Width:=80, Height:=40).Fill
 .ForeColor.RGB = RGB(128, 0, 0)
 .BackColor.RGB = RGB(0, 0, 255)
 .Patterned Pattern:=msoPatternDarkVertical
End With


PbMergeType Enumeration (Publisher)

 Copy code hover
[image]

PbMergeType Enumeration (Publisher)
Send feedback

Constants that specify the type of mail merge, passed to and returned by the MailMergeDataSource.Type property.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbCatalogMerge | 3 | Catalog merge
pbEmailMerge | 4 | E-mail merge
pbMailMerge | 2 | Mail merge
pbMergeDefault | 0 | Default merge


ShapeRange.Copy Method (Publisher)

 Copy code hover
[image]

ShapeRange.Copy Method (Publisher)
Send feedback

Copies the specified object to the Clipboard.

Syntax

expression .Copy

expression A variable that represents a ShapeRange object.

Return Value

Nothing

Remarks

Use the Paste method to paste the contents of the Clipboard.

The Copy method can be used on Shape objects, but the Paste method cannot.

Example

This example copies shapes one and two on page one of the active publication to the Clipboard and then pastes the copies onto page two.

VBA Copy code Copy code
With ActiveDocument
 .Pages(1).Shapes.Range(Array(1, 2)).Copy
 .Pages(2).Shapes.Paste
End With

This example copies shape one on page one of the active publication to the Clipboard.

Copy code Copy code
ActiveDocument.Pages(1).Shapes(1).Copy

This example copies the text in shape one on page one of the active publication to the Clipboard.

Copy code Copy code
ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange.Copy


ThreeDFormat Object (Publisher)

 Copy code hover
[image]

ThreeDFormat Object (Publisher)
Send feedback

Represents a shape's three-dimensional formatting.

Remarks

You cannot apply three-dimensional formatting to some kinds of shapes, such as beveled shapes. Most of the properties and methods of the ThreeDFormat object for such a shape will fail.

Example

Use the ThreeD property to return a ThreeDFormat object. This example sets the depth, extrusion color, extrusion direction, and lighting direction for the 3-D effects applied to shape one in the active publication.

Copy code Copy code
Sub SetThreeDSettings()
 Dim tdfTemp As ThreeDFormat

 Set tdfTemp = _
 ActiveDocument.Pages(1).Shapes(1).ThreeD

 With tdfTemp
 .Visible = True
 .Depth = 50
 .ExtrusionColor.RGB = RGB(255, 100, 255)
 .SetExtrusionDirection _
 PresetExtrusionDirection:=msoExtrusionTop
 .PresetLightingDirection = msoLightingLeft
 End With
End Sub


Row Object (Publisher)

 Copy code hover
[image]

Row Object (Publisher)
Send feedback

Represents a row in a table. The Row object is a member of the Rows collection. The Rows collection includes all the rows in a specified table.

Example

Use Rows(index), where index is the row number, to return a single Row object. The index number represents the position of the row in the Rows collection (counting from left to right). This example selects the first row in the first shape on the second of the active publication. This example assumes the specified shape is a table and not another type of shape.

Copy code Copy code
Sub SelectRow()
 ActiveDocument.Pages(2).Shapes(1).Table.Rows(1).Cells.Select
End Sub

Use the Item method of a Rows collection to return a Row object. This example sets the fill for all even numbered rows and clears the fill for all odd numbered rows in the specified table. This example assumes the specified shape is a table and not another type of shape.

Copy code Copy code
Sub FillCellsByRow()
 Dim shpTable As Shape
 Dim rowTable As Row
 Dim celTable As Cell

 Set shpTable = ActiveDocument.Pages(2).Shapes(1)
 For Each rowTable In shpTable.Table.Rows
 For Each celTable In rowTable.Cells
 If celTable.Row Mod 2 = 0 Then
 celTable.Fill.ForeColor.RGB = RGB _
 (Red:=180, Green:=180, Blue:=180)
 Else
 celTable.Fill.ForeColor.RGB = RGB _
 (Red:=255, Green:=255, Blue:=255)
 End If
 Next celTable
 Next rowTable

End Sub

Use the Add method to add a row to a table. This example adds a row to the specified table on the second page of the active publication, and then adjusts the width, merges the cells, and sets the fill color. This example assumes the first shape is a table and not another type of shape.

Copy code Copy code
Sub NewRow()
 Dim rowNew As Row

 Set rowNew = ActiveDocument.Pages(2).Shapes(1).Table.Rows _
 .Add(BeforeRow:=3)
 With rowNew
 .Height = 2
 .Cells.Merge
 .Cells(1).Fill.ForeColor.RGB = RGB(Red:=0, Green:=0, Blue:=0)
 End With
End Sub

Use the Delete method to delete a row from a table. This example deletes the row added in the above example.

Copy code Copy code
Sub DeleteRow()
 ActiveDocument.Pages(2).Shapes(1).Table.Rows(3).Delete
End Sub


Shape.PickUp Method (Publisher)

 Copy code hover
[image]

Shape.PickUp Method (Publisher)
Send feedback

Copies formatting from a shape or shape range so that it can be copied to another shape or shape range using the Apply method.

Syntax

expression .PickUp

expression A variable that represents a Shape object.

Return Value

Nothing

Remarks

You must use the PickUp method to copy the formatting from a shape or shape range before using the Apply method; otherwise, an error occurs.

Example

The following example copies the formatting from the first shape of the active publication to the second shape of the active publication.

Copy code Copy code
With ActiveDocument.Pages(1)
 .Shapes(1).PickUp
 .Shapes(2).Apply
End With


PictureFormat.RestoreOriginalColors Method (Publisher)

 Copy code hover
[image]

PictureFormat.RestoreOriginalColors Method (Publisher)
Send feedback

Restores the original colors of a picture that was recolored.

Version Information

Version Added: Publisher 2007

Syntax

expression .RestoreOriginalColors

expression A variable that represents a PictureFormat object.

Remarks

The RestoreOriginalColors method corresponds to the Restore Original Colors button in the Recolor Picture dialog box. (On the Format menu, click Picture, and then click Recolor)

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the RestoreOriginalColors method to restore the original colors of a picture that was recolored by using the PictureFormat.Recolor method. It recolors the first shape in the Shapes collection on the first page of the publication and then restores its original colors.

For this example to work, the recolored shape must be either a picture or an OLE object that represents a picture.

VBA Copy code Copy code
Public Sub RestoreOriginalColors_Example()

 Dim pubPictureFormat As Publisher.PictureFormat
 Dim pubShape As Publisher.Shape
 Dim pubColorFormat As Publisher.ColorFormat

 Set pubShape = ThisDocument.Pages(1).Shapes(1)

 Set pubPictureFormat = pubShape.PictureFormat
 Set pubColorFormat = pubShape.Fill.BackColor

 pubPictureFormat.Recolor pubColorFormat, msoTrue
 MsgBox "Picture was recolored."
 pubPictureFormat.RestoreOriginalColors
 MsgBox "Original colors in picture were restored."

End Sub


CalloutFormat.Type Property (Publisher)

 Copy code hover
[image]

CalloutFormat.Type Property (Publisher)
Send feedback

Returns or sets an MsoCalloutType constant that represents the callout type. Read/write.

Syntax

expression .Type

expression A variable that represents a CalloutFormat object.

Remarks

The Type property value can be one of these MsoCalloutType constants.

msoCalloutFour

msoCalloutMixed

msoCalloutOne

msoCalloutThree

msoCalloutTwo


Shape.AlternativeText Property (Publisher)

 Copy code hover
[image]

Shape.AlternativeText Property (Publisher)
Send feedback

Returns or sets a String representing the text displayed by a Web browser in place of the Shape object while the Shape object is being downloaded or when graphics are turned off. Read/write.

Syntax

expression .AlternativeText

expression A variable that represents a Shape object.

Remarks

The maximum length of the AlternativeText property is 254 characters. Microsoft Publisher returns an error if the text length exceeds this number.

Example

This example sets the alternative text for the selected shape in the active document. This example assumes that you have a publication that the selected shape is a picture of a duck.

Copy code Copy code
Public Sub Alternative_Text()

 ' The picture of a duck must be selected.
 Publisher.ActiveDocument.Selection.ShapeRange _
 .AlternativeText = "This is a mallard duck."

End Sub


GlowFormat.Color Property (Publisher)

 Copy code hover
[image]

GlowFormat.Color Property (Publisher)
See also Send feedback

Returns a ColorFormat object that represents the color for a glow effect. Read-only.

Version Information

Version Added: Publisher 2013

Syntax

expression .Color

expression A variable that represents a GlowFormat object.

Return value

COLORFORMAT

See also

Other resources

GlowFormat Object
GlowFormat Object Members


WebNavigationBarHyperlinks.Parent Property (Publisher)

 Copy code hover
[image]

WebNavigationBarHyperlinks.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a WebNavigationBarHyperlinks object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


TextFrame.Application Property (Publisher)

 Copy code hover
[image]

TextFrame.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a TextFrame object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


InstalledPrinters Properties (Publisher)

 Copy code hover
[image]

InstalledPrinters Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the creator of the parent InstalledPrinters object. Read-only.
Count | Returns the number of printers installed on your computer. Read-only.
Item | Returns the Printer object with the specified name or at the specified index position in the InstalledPrinters collection. Read-only.
Parent | Returns the parent of the InstalledPrinters object. Read-only.


PageSize.HorizontalGap Property (Publisher)

 Copy code hover
[image]

PageSize.HorizontalGap Property (Publisher)
Send feedback

Returns a Variant that represents the distance between the right edge of one publication page and left edge of the next publication page in the same row in the blank page size represented by the parent PageSize object when multiple pages are printed on one sheet of printer paper. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .HorizontalGap

expression A variable that represents a PageSize object.

Return Value

Variant

Remarks

The blank page size represented by the parent PageSize object corresponds to one of the icons displayed under Blank Page Sizes in the Page Setup dialog box in the Microsoft Publisher user interface.

Numeric values are evaluated as points; string values can be in any unit supported by Microsoft Publisher (for example, "2.5 in"). The valid range of possible values is from zero to the difference between the sheet width and the page width.


WebOptions.Parent Property (Publisher)

 Copy code hover
[image]

WebOptions.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a WebOptions object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


TextStyles.Item Method (Publisher)

 Copy code hover
[image]

TextStyles.Item Method (Publisher)
Send feedback

Returns an individual object in a specified collection.

Syntax

expression .Item(Index)

expression A variable that represents a TextStyles object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The number or name of the field or list box item to return.

Return Value

TextStyle

Example

This example returns the "Normal" text style from the active publication.

VBA Copy code Copy code
Dim txtStyle As TextStyle

Set txtStyle = ActiveDocument.TextStyles.Item(Index:="Normal")


FindReplace Members (Publisher)

 Copy code hover
[image]

FindReplace Members (Publisher)
Send feedback

Represents the criteria for a find operation. The properties and methods of the FindReplace object correspond to the options in the Find and Replace dialog box.

Methods

Name | Description
Clear | Removes the specified search criteria in a find or replace operation.
Execute | Performs the specified Find or Replace operation.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
FindText | Sets or retrieves a String representing the text to find in the specified range or selection. Read/write.
Forward | Sets or retrieves a Boolean representing the direction of the text search. True if the find operation searches forward through the document. False if it searches backward through the document. Read/write.
FoundTextRange | Returns a TextRange object that represents the found text or replaced text of a find operation. Read-only.
MatchAlefHamza | Sets or returns a Boolean representing whether or not a search operation will match alefs and hamzas. Read/write.
MatchCase | Sets or returns a Boolean that represents the case sensitivity of the search operation. Read/write.
MatchDiacritics | Sets or returns a Boolean representing whether or not a search operation will match diacritics. Read/write.
MatchKashida | Sets or returns a Boolean representing whether or not a search operation will match kashidas. Read/write.
MatchWholeWord | Sets or returns a Boolean that represents whether the whole word will be matched in the search operation. Read/write. Boolean.
MatchWidth | Sets or returns a Boolean representing whether or not a search operation will match the character width of the searched text. Read/Write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
ReplaceScope | Specifies how many scope replacements are to be made: one, all, or none. Read/write.
ReplaceWithText | Sets or retrieves a String representing the replacement text in the specified range or selection. Read/write.


CellRange.Select Method (Publisher)

 Copy code hover
[image]

CellRange.Select Method (Publisher)
Send feedback

Selects the specified object.

Syntax

expression .Select

expression A variable that represents a CellRange object.

Example

This example selects the upper-left cell from a table that has been added to the first page in the active publication.

VBA Copy code Copy code
Dim shpTable As Shape
Dim cllTemp As Cell

With ActiveDocument.Pages(1).Shapes
 Set shpTable = .AddTable(NumRows:=3, NumColumns:=3, _
 Left:=100, Top:=100, Width:=150, Height:=150)
 Set cllTemp = shpTable.Table.Cells.Item(1)
 cllTemp.Select
End With

This example selects the first column from a table that has been added to the first page in the active publication.

VBA Copy code Copy code
Dim shpTable As Shape
Dim crTemp As CellRange

With ActiveDocument.Pages(1).Shapes
 Set shpTable = .AddTable(NumRows:=3, NumColumns:=3, _
 Left:=100, Top:=100, Width:=150, Height:=150)
 Set crTemp = shpTable.Table.Cells(StartRow:=1, _
 StartColumn:=1, EndRow:=3, EndColumn:=1)
 crTemp.Select
End With

This example selects the first five characters in shape one on page one of the active publication.

VBA Copy code Copy code
ActiveDocument.Pages(1).Shapes(1).TextFrame _
 .TextRange.Characters(1, 5).Select


Document.MailMerge Property (Publisher)

 Copy code hover
[image]

Document.MailMerge Property (Publisher)
Send feedback

Returns a MailMerge object that represents the mail merge functionality for the specified publication.

Syntax

expression .MailMerge

expression A variable that represents a Document object.

Return Value

MailMerge

Example

This example displays the information from the current record in the data source.

VBA Copy code Copy code
Sub ViewMergeData()
 ActiveDocument.MailMerge.ViewMailMergeFieldCodes = False
End Sub

This example displays the Mail Merge Recipients dialog box, which contains the records from the data source.

Copy code Copy code
Sub ExecuteMergeField()
 ActiveDocument.MailMerge.DataSource.OpenRecipientsDialog
End Sub


WizardValue Object (Publisher)

 Copy code hover
[image]

WizardValue Object (Publisher)
Send feedback

Represents a possible value for the specified wizard property.

Example

Use the Item property of the WizardValues collection to return a WizardValue object. The following example displays the current value for the first wizard property in the active publication and then lists all the other possible values.

Copy code Copy code
Dim valAll As WizardValues
Dim valLoop As WizardValue

With ActiveDocument.Wizard
 Set valAll = .Properties(1).Values

 MsgBox "Wizard: " & .Name & vbLf & _
 "Property: " & .Properties(1).Name & vbLf & _
 "Current value: " & .Properties(1).CurrentValueId

 For Each valLoop In valAll
 MsgBox "Possible value: " & valLoop.ID & " (" & valLoop.Name & ")"
 Next valLoop
End With


Hyperlink.EmailSubject Property (Publisher)

 Copy code hover
[image]

Hyperlink.EmailSubject Property (Publisher)
Send feedback

Sets or returns a String that represents the subject for e-mail messages generated to process Web form data. Read/write.

Syntax

expression .EmailSubject

expression A variable that represents a Hyperlink object.

Example

This example sets Publisher to process data on the Web form in the current publication by sending an e-mail message with a subject line to a specified e-mail address.

Copy code Copy code
Sub WebFormData()
 With ThisDocument.Pages(1).Shapes(1).WebCommandButton
 .DataRetrievalMethod = pbSubmitDataRetrievalEmail
 .EmailAddress = "someone@example.com"
 .EmailSubject = "Web form data"
 End With
End Sub


GroupShapes.Application Property (Publisher)

 Copy code hover
[image]

GroupShapes.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a GroupShapes object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


PbReplaceScope Enumeration (Publisher)

 Copy code hover
[image]

PbReplaceScope Enumeration (Publisher)
Send feedback

Specifies how many replacements are to be made: one, all, or none.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbReplaceScopeAll | 2 | All need to be replaced.
pbReplaceScopeNone | 0 | None need to be replaced.
pbReplaceScopeOne | 1 | One needs to be replaced.


MailMergeDataSource.SetAllErrorFlags Method (Publisher)

 Copy code hover
[image]

MailMergeDataSource.SetAllErrorFlags Method (Publisher)
Send feedback

Marks all records in a mail merge data source as containing invalid data in an address field.

Syntax

expression .SetAllErrorFlags(Invalid, InvalidComment)

expression A variable that represents a MailMergeDataSource object.

Parameters

Name | Required/Optional | Data Type | Description
Invalid | Required | Boolean | True marks all records in the data source of a mail merge as invalid.
InvalidComment | Optional | String | Text describing the invalid setting.

Remarks

You can individually mark records in a data source that contain invalid data in an address field using the InvalidAddress and InvalidComments properties.

Example

This example marks all records in the data source as containing an invalid address field, sets a comment as to why it is invalid, and excludes all records from the mail merge.

Copy code Copy code
Sub FlagAllRecords()
 With ActiveDocument.MailMerge.DataSource
 .SetAllErrorFlags Invalid:=True, InvalidComment:= _
 "All records in the data source have only 5-" _
 & "digit ZIP Codes. Need 5+4 digit ZIP Codes."
 .SetAllIncludedFlags Included:=False
 End With
End Sub


MailMergeDataFields Properties (Publisher)

 Copy code hover
[image]

MailMergeDataFields Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Creator | Returns a Long that represents the application in which the specified object was created. For example, if the object was created in Microsoft Publisher, this property returns the hexadecimal number 4D505542, which represents the string "MSPB." This value can also be represented by the constant.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Application.TwipsToPoints Method (Publisher)

 Copy code hover
[image]

Application.TwipsToPoints Method (Publisher)
See also Send feedback

Converts a measurement from twips to points (20 twips = 1 point). Returns the converted measurement as a Single.

Syntax

expression .TwipsToPoints(Value)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Value | Required | Single | The twip value to be converted to points.

Return Value

Single

Remarks

Use the PointsToTwips method to convert measurements in points to twips.

Example

This example converts measurements in twips entered by the user to measurements in points.

Copy code Copy code
Dim strInput As String
Dim strOutput As String

Do While True
 ' Get input from user.
 strInput = InputBox( _
 Prompt:="Enter measurement in twips (0 to cancel): ", _
 Default:="0")

 ' Exit the loop if user enters zero.
 If Val(strInput) = 0 Then Exit Do

 ' Evaluate and display result.
 strOutput = Trim(strInput) & " twips = " _
 & Format(Application _
 .TwipsToPoints(Value:=Val(strInput)), _
 "0.00") & " points"

 MsgBox strOutput
Loop

See also

Concepts

Application Object

Other resources

Application Object Members


Rows.Application Property (Publisher)

 Copy code hover
[image]

Rows.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a Rows object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


MailMerge.DataSource Property (Publisher)

 Copy code hover
[image]

MailMerge.DataSource Property (Publisher)
Send feedback

Returns a MailMergeDataSource object that refers to the data source attached to a mail merge or catalog merge main publication.

Syntax

expression .DataSource

expression A variable that represents a MailMerge object.

Return Value

MailMergeDataSource

Example

This example displays the path and file name of the data source attached to the active publication.

Copy code Copy code
Sub DataSourceName()
 With ActiveDocument.MailMerge.DataSource
 If .Name <> "" Then _
 MsgBox "The path and file name of the " & _
 "attached data source is : " & vbCr & .Name
 End With
End Sub


Pages.Application Property (Publisher)

 Copy code hover
[image]

Pages.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a Pages object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


PageSetup.LeftMargin Property (Publisher)

 Copy code hover
[image]

PageSetup.LeftMargin Property (Publisher)
Send feedback

Returns a Variant that represents the distance (in points) between the left edge of the printer sheet and the left edge of the publication pages when multiple pages are printed on a single sheet. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .LeftMargin

expression A variable that represents a PageSetup object.

Return Value

Variant

Remarks

Numeric values are evaluated as points. String values can be in any unit supported by Microsoft Publisher (for example, 2.5 in). The valid range of possible values is from zero to the difference between the sheet width and the page width.

The LeftMargin property returns a value only when you print multiple pages on a single sheet of printer paper. If you try to use the LeftMargin property in other circumstances, Microsoft Publisher will return Nothing.


Rows Methods (Publisher)

 Copy code hover
[image]

Rows Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Add | Adds a new Row object to the specified Rows collection and returns the new Row object.
Item | Returns an individual object in a specified collection.


Shapes.AddTextEffect Method (Publisher)

 Copy code hover
[image]

Shapes.AddTextEffect Method (Publisher)
Send feedback

Adds a new Shape object representing a WordArt object to the specified Shapes collection.

Syntax

expression .AddTextEffect(PresetTextEffect, Text, FontName, FontSize, FontBold, FontItalic, Left, Top)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
PresetTextEffect | Required | MsoPresetTextEffect | The preset text effect to use. The values of the MsoPresetTextEffect constants correspond to the formats listed in the WordArt Gallery dialog box (numbered from left to right and from top to bottom).
Text | Required | String | The text to use for the WordArt object.
FontName | Required | String | The name of the font to use for the WordArt object.
FontSize | Required | Variant | The font size to use for the WordArt object. Numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").
FontBold | Required | MsoTriState | Determines whether to format the WordArt text as bold.
FontItalic | Required | MsoTriState | Determines whether to format the WordArt text as italic.
Left | Required | Variant | The position of the left edge of the shape representing the WordArt object.
Top | Required | Variant | The position of the top edge of the shape representing the WordArt object.

Return Value

Shape

Remarks

For the Left and Top parameters, numeric values are evaluated in points; strings can be in any units supported by Publisher (for example, "2.5 in").

The height and width of the WordArt object is determined by its text and formatting.

Use the TextEffect property to return a TextEffectFormat object whose properties can be used to edit an existing WordArt object.

The PresetTextEffect parameter can be one of the MsoPresetTextEffect constants declared in the Microsoft Office type library. The msoTextEffectMixed constant is not supported.

The FontBold parameter can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | Do not format the WordArt text as bold.
msoTrue | Format the WordArt text as bold.

The FontItalic parameter can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | Do not format the WordArt text as italic.
msoTrue | Format the WordArt text as italic.

Example

The following example adds a WordArt object to the first page of the active publication.

VBA Copy code Copy code
Dim shpWordArt As Shape

Set shpWordArt = ActiveDocument.Pages(1).Shapes.AddTextEffect _
 (PresetTextEffect:=msoTextEffect7, Text:="Annual Report", _
 FontName:="Arial Black", FontSize:=24, _
 FontBold:=msoFalse, FontItalic:=msoFalse, _
 Left:=144, Top:=72)


EmailMergeEnvelope.Priority Property (Publisher)

 Copy code hover
[image]

EmailMergeEnvelope.Priority Property (Publisher)
Send feedback

Gets or sets the priority of the merged e-mail message represented by the parent EmailMergeEnvelope object. Read/write.

Version Information

Version Added: Publisher 2007

Syntax

expression .Priority

expression A variable that represents an EmailMergeEnvelope object.

Return Value

pbEmailMergePriority

Remarks

Possible values for the Priority property are declared in the pbEmailMergePriority enumeration and shown in the following table.

Constant | Value | Description
pbPriorityNone | 0 | No priority set
pbPriorityLow | 2 | Low priority
pbPriorityHigh | 1 | High priority


Columns Methods (Publisher)

 Copy code hover
[image]

Columns Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Add | Adds a new Column object to the specified Columns collection and returns the new Column object.
Item | Returns an individual Column object in the specified Columns collection.


PbSelectionType Enumeration (Publisher)

 Copy code hover
[image]

PbSelectionType Enumeration (Publisher)
Send feedback

Represents the selection type.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbSelectionNone | 0 | Selection type none.
pbSelectionShape | 1 | Selection type shape.
pbSelectionShapeSubSelection | 4 | Selection type subselection.
pbSelectionTableCells | 3 | Selection type table cells.
pbSelectionText | 2 | Selection type text.


WebOptionButton.ReturnDataLabel Property (Publisher)

 Copy code hover
[image]

WebOptionButton.ReturnDataLabel Property (Publisher)
Send feedback

Returns or sets a String that represents the text used by the Web page to label the specified Web object when the page is submitted. Read/write.

Syntax

expression .ReturnDataLabel

expression A variable that represents a WebOptionButton object.

Example

This example creates a new Web text box and specifies the label for the text in the text box when the page is submitted.

Copy code Copy code
Sub LabelWebTextBoxControl()
 With ActiveDocument.Pages(1).Shapes _
 .AddWebControl(Type:=pbWebControlSingleLineTextBox, _
 Left:=100, Top:=100, Width:=300, Height:=15).WebTextBox
 .DefaultText = "Please enter your name here"
 .Limit = 70
 .RequiredControl = msoTrue
 .ReturnDataLabel = "Full_Name"
 End With
End Sub


ShadowFormat Properties (Publisher)

 Copy code hover
[image]

ShadowFormat Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Blur | Returns or sets a Single that represents the blur level for a shadow format. Read/write.
ForeColor | Returns or sets a ColorFormat object representing the foreground color for the fill, line, or shadow. Read/write.
Obscured | Returns or sets an MsoTriState value indicating whether the shadow of the specified shape appears filled in and is obscured by the shape. Read/write.
OffsetX | Returns or sets a Variant value indicating the vertical offset of the shadow from the specified shape. A positive value offsets the shadow below the shape; a negative value offsets it above the shape. Read/write.
OffsetY | Returns or sets a Variant value indicating the horizontal offset of the shadow from the specified shape. A positive value offsets the shadow to the right of the shape; a negative value offsets it to the left. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
RotateWithShape | Returns or sets an MsoTriState constant that represents whether to rotate the shadow when rotating the shape. Read/write.
Size | Returns or sets a Single that represents the width of the shadow. Read/write.
Type | Specifies the shadow type of a shape. Read/write.
Visible | Returns or sets an MsoTriState constant indicating whether the specified object or the formatting applied to the specified object is visible. Read/write.


WizardValues Properties (Publisher)

 Copy code hover
[image]

WizardValues Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Item | Returns an individual object from a specified collection. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Window.Top Property (Publisher)

 Copy code hover
[image]

Window.Top Property (Publisher)
Send feedback

Returns or sets a Long that represents the distance between the top edge of the screen and the application window. Read/write.

Syntax

expression .Top

expression A variable that represents a Window object.

Example

This example verifies that the state of application window is neither maximized nor minimized and then resizes the window and moves it to 150 points from the top of the screen.

VBA Copy code Copy code
Sub MoveWindow()
 With ActiveWindow
 If .WindowState = pbWindowStateNormal Then
 .Top = 150
 .Resize Width:=500, Height:=500
 End If
 End With
End Sub


MailMergeFilters.Delete Method (Publisher)

 Copy code hover
[image]

MailMergeFilters.Delete Method (Publisher)
Send feedback

Deletes the specified object.

Syntax

expression .Delete

expression A variable that represents a MailMergeFilters object.

Remarks

A run-time error occurs if the specified object does not exist.


PictureFormat.LeaveBlackAsBlack Property (Publisher)

 Copy code hover
[image]

PictureFormat.LeaveBlackAsBlack Property (Publisher)
Send feedback

Returns True if, when you recolor the image represented by the parent PictureFormat object, the black parts of the original image should remain black. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .LeaveBlackAsBlack

expression A variable that represents a PictureFormat object.

Return Value

MsoTriState

Remarks

The LeaveBlackAsBlack property corresponds to the Leave black parts black option in the Recolor Picture dialog box in the Microsoft Publisher user interface. (On the Format menu, click Picture, and then click Recolor).


Font.AttachedToText Property (Publisher)

 Copy code hover
[image]

Font.AttachedToText Property (Publisher)
Send feedback

True if the Font or ParagraphFormat object is attached to a TextRange object. If the object is attached to a TextRange object, the document will be updated when properties of the object are changed. If the object is not attached, nothing in the document will be changed until the object is applied to a TextRange or Style object. Read-only Boolean.

Syntax

expression .AttachedToText

expression A variable that represents a Font object.

Example

This example duplicates the font formatting; then it checks to see if the duplicated formatting is attached to a text range and if it is not, it attaches the formatting to the second shape.

Copy code Copy code
Sub DuplicateText()
 Dim fntTemp As Font
 With ActiveDocument.Pages(1)
 Set fntTemp = .Shapes(1).TextFrame.TextRange.Font.Duplicate
 If fntTemp.AttachedToText <> True Then _
 ActiveDocument.Pages(1).Shapes(2) _
 .TextFrame.TextRange.Font = fntTemp
 End With
End Sub


PictureFormat.Remove Method (Publisher)

 Copy code hover
[image]

PictureFormat.Remove Method (Publisher)
Send feedback

Removes the picture from its frame, leaving in its place a picture placeholder. Any previous formatting applied to the picture is retained. Returns nothing.

Version Information

Version Added: Publisher 2010

Syntax

expression .Remove

expression A variable that represents a PictureFormat object.


Plates Methods (Publisher)

 Copy code hover
[image]

Plates Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Add | Adds a new color plate to the specified Plates object.
FindPlateByInkName | Returns a Plate object that represents the plate of the specified ink name.


PageSetup Object (Publisher)

 Copy code hover
[image]

PageSetup Object (Publisher)
Send feedback

Contains information about the page setup for the pages in a publication.

Example

Use the PageSetup property to return the PageSetup object. The following example sets all pages in the active publication to be 8.5 inches wide and 11 inches high.

Copy code Copy code
Sub SetPageSetupOptions()
 With ActiveDocument.PageSetup
 .PageHeight = 11 * 72
 .PageWidth = 8.5 * 72
 End With
End Sub


Pages.FindByPageID Method (Publisher)

 Copy code hover
[image]

Pages.FindByPageID Method (Publisher)
Send feedback

Returns a Page object that represents the page with the specified page ID number. Each page is automatically assigned a unique ID number when it is created. Use the PageID property to return a page's ID number.

Syntax

expression .FindByPageID(PageID)

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
PageID | Required | Long | Specifies the ID number of the page you want to return. Publisher assigns this number when the page is created.

Return Value

Page

Remarks

Unlike the PageIndex property, the PageID property of a Page object won't change when you add pages to or rearrange pages in the publication. Therefore, using the FindByPageID method with the page ID number can be a more reliable way to return a specific Page object from a Pages collection than using the Item method with the page's index number.

Example

This example demonstrates how to retrieve the unique ID number for a Page object and then use this number to return that Page object from the Pages collection and add a new shape to the page.

Copy code Copy code
Sub FindPage()
 Dim lngPageID As Long

 'Get page ID
 lngPageID = ActiveDocument.Pages.Add(Count:=1, After:=1).PageID

 'Use page ID to add a new shape to the page
 ActiveDocument.Pages.FindByPageID(PageID:=lngPageID) _
 .Shapes.AddShape Type:=msoShape5pointStar, _
 Left:=200, Top:=72, Width:=50, Height:=50

End Sub


MailMergeDataSources Methods (Publisher)

 Copy code hover
[image]

MailMergeDataSources Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Item | Returns the MailMergeDataSource object at the specified index position in the MailMergeDataSources collection.


ConnectorFormat.BeginConnectionSite Property (Publisher)

 Copy code hover
[image]

ConnectorFormat.BeginConnectionSite Property (Publisher)
Send feedback

Returns a Long indicating the connection site to which the beginning of a connector is connected. Read-only.

Syntax

expression .BeginConnectionSite

expression A variable that represents a ConnectorFormat object.

Return Value

Long

Remarks

If the beginning of the specified connector isn't attached to a shape, this property generates an error.

Use the EndConnectionSite property to return the site to which the end of a connector is connected.

Example

This example assumes that the first page in the active publication already contains two shapes attached by a connector named Conn1To2. The code adds a rectangle and a connector to the first page. The beginning of the new connector will be attached to the same connection site as the beginning of the connector named Conn1To2, and the end of the new connector will be attached to connection site one on the new rectangle.

Copy code Copy code
Dim shpNew As Shape
Dim intSite As Integer
Dim shpOld As Shape

With ActiveDocument.Pages(1).Shapes

 ' Add new rectangle.
 Set shpNew = .AddShape(Type:=msoShapeRectangle, _
 Left:=450, Top:=190, Width:=200, Height:=100)

 ' Add new connector.
 .AddConnector(Type:=msoConnectorCurve, _
 BeginX:=0, BeginY:=0, EndX:=10, EndY:=10) _
 .Name = "Conn1To3"

 ' Get connection site number of old shape, and set
 ' reference to old shape.
 With .Item("Conn1To2").ConnectorFormat
 intSite = .BeginConnectionSite
 Set shpOld = .BeginConnectedShape
 End With

 ' Connect new connector to old shape and new rectangle.
 With .Item("Conn1To3").ConnectorFormat
 .BeginConnect ConnectedShape:=shpOld, _
 ConnectionSite:=intSite
 .EndConnect ConnectedShape:=shpNew, _
 ConnectionSite:=1
 End With
End With


BorderArts.Count Property (Publisher)

 Copy code hover
[image]

BorderArts.Count Property (Publisher)
See also Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a BorderArts object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub

See also

Concepts

BorderArts Object

Other resources

BorderArts Object Members


PbFieldType Enumeration (Publisher)

 Copy code hover
[image]

PbFieldType Enumeration (Publisher)
Send feedback

Represents the field type.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbFieldDateTime | 4 | Date and time
pbFieldHyperlinkAbsolutePage | 11 | Absolute page hyperlink
pbFieldHyperlinkEmail | 12 | E-mail hyperlink
pbFieldHyperlinkFile | 13 | File hyperlink
pbFieldHyperlinkRelativePage | 10 | Relative page hyperlink
pbFieldHyperlinkURL | 9 | URL hyperlink
pbFieldIHIV | 6 | IHIV
pbFieldMailMerge | 5 | Mail merge
pbFieldNone | 0 | None
pbFieldPageNumber | 1 | Page number
pbFieldPageNumberNext | 2 | Next page number
pbFieldPageNumberPrev | 3 | Previous page number
pbFieldPersonalizedHyperlinkURL | 14 | Personalized hyperlink URL
pbFieldPhoneticGuide | 7 | Phonetic guide
pbFieldWizardSampleText | 8 | Wizard sample text


ShapeRange.Callout Property (Publisher)

 Copy code hover
[image]

ShapeRange.Callout Property (Publisher)
Send feedback

Returns a CalloutFormat object representing the formatting of a line callout.

Syntax

expression .Callout

expression A variable that represents a ShapeRange object.

Example

This example adds an oval to the active publication and a callout that points to the oval. The callout text won't have a border, but it will have a vertical accent bar that separates the text from the callout line.

VBA Copy code Copy code
Sub NewShapeItem()

 Dim shpNew As Shapes

 Set shpNew = Application.ActiveDocument.MasterPages(1).Shapes
 With shpNew
 .AddShape Type:=msoShapeOval, Left:=180, _
 Top:=200, Width:=280, Height:=130
 With .AddCallout(Type:=msoCalloutTwo, Left:=420, _
 Top:=170, Width:=170, Height:=40)
 .TextFrame.TextRange = "Big Oval"
 With .Callout
 .Accent = msoTrue
 .Border = msoFalse
 End With
 End With
 End With

End Sub


PageSize.PageHeight Property (Publisher)

 Copy code hover
[image]

PageSize.PageHeight Property (Publisher)
Send feedback

Gets or sets the page height of the blank page size represented by the parent PageSize object. Read/write.

Version Information

Version Added: Publisher 2007

Syntax

expression .PageHeight

expression A variable that represents a PageSize object.

Return Value

Variant

Remarks

The blank page size represented by the parent PageSize object corresponds to one of the icons displayed under Blank Page Sizes in the Page Setup dialog box in the Microsoft Publisher user interface (File menu).


Font.Duplicate Method (Publisher)

 Copy code hover
[image]

Font.Duplicate Method (Publisher)
Send feedback

Creates a duplicate of the specified Font object and then returns the new Font object.

Syntax

expression .Duplicate

expression A variable that represents a Font object.

Return Value

Font

Example

The following example duplicates the character formatting information from the text range in shape one on page one of the active publication and applies it to the text range in shape two.

VBA Copy code Copy code
Dim fntTemp As Font

With ActiveDocument.Pages(1)
 Set fntTemp = _
 .Shapes(1).TextFrame.TextRange.Font.Duplicate
 .Shapes(2).TextFrame.TextRange.Font = fntTemp
End With


ThreeDFormat Properties (Publisher)

 Copy code hover
[image]

ThreeDFormat Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
BevelBottomDepth | Returns or sets a Single that represents the depth of the bottom bevel. Read/write.
BevelBottomInset | Returns or sets a Single that represents the inset size for the bottom bevel. Read/write.
BevelBottomType | Returns or sets an MsoPresetCamera constant that represents the bevel type for the bottom bevel. Read/write.
BevelTopDepth | Returns or sets a Single that represents the depth of the top bevel. Read/write.
BevelTopInset | Returns or sets a Single that represents the depth of the top bevel. Read/write.
BevelTopType | Returns or sets an MsoPresetCamera constant that represents the bevel type for the top bevel. Read/write.
ContourColor | Returns or sets a ColorFormat object that represents color of the contour of a shape. Read/write.
ContourWidth | Returns or sets a Single that represents the width of the contour of a shape. Read/write.
Depth | Returns or sets a Variant indicating the depth of the shape's extrusion. Read/write.
ExtrusionColor | Returns a ColorFormat object representing the color of the shape's extrusion.
ExtrusionColorType | Returns or sets an MsoExtrusionColorType constant indicating whether the extrusion color is based on the extruded shape's fill (the front face of the extrusion) and automatically changes when the shape's fill changes, or whether the extrusion color is independent of the shape's fill. Read/write.
FieldOfView | Returns or sets a Single that represents the amount of perspective for a shape. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Perspective | msoTrue if the extrusion appears in perspective — that is, if the walls of the extrusion narrow toward a vanishing point. msoFalse if the extrusion is a parallel, or orthographic, projection — that is, if the walls don't narrow toward a vanishing point. Read/write.
PresetExtrusionDirection | Returns an MsoPresetExtrusionDirection constant that represents the direction taken by the extrusion's sweep path leading away from the extruded shape (the front face of the extrusion). Read-only.
PresetLightingDirection | Returns or sets an MsoPresetLightingDirection constant that represents the position of the light source relative to the extrusion. Read/write.
PresetLightingSoftness | Returns or sets a MsoPresetLightingSoftness constant that represents the intensity of the extrusion lighting. Read/write.
PresetMaterial | Returns or sets an MsoPresetMaterial constant that represents the extrusion surface material. Read/write.
PresetThreeDFormat | Returns an MsoPresetThreeDFormat constant that represents the preset extrusion format. Read-only.
RotationX | Returns or sets the rotation of the extruded shape around the x-axis in degrees. Can be a value from - 90 through 90. A positive value indicates upward rotation; a negative value indicates downward rotation. Read/write Single.
RotationY | Returns or sets the rotation of the extruded shape around the y-axis, in degrees. Can be a value from - 90 through 90. A positive value indicates rotation to the left; a negative value indicates rotation to the right. Read/write Single.
Visible | Returns or sets an MsoTriState constant indicating whether the specified object or the formatting applied to the specified object is visible. Read/write.


Hyperlink.TextToDisplay Property (Publisher)

 Copy code hover
[image]

Hyperlink.TextToDisplay Property (Publisher)
Send feedback

Returns or sets a String that represents the text displayed for a hyperlink. Read/write.

Syntax

expression .TextToDisplay

expression A variable that represents a Hyperlink object.

Return Value

String

Example

This example sets the hyperlink display text and address of the first hyperlink on the first page. This example assumes the first page of the active publication contains at least one shape with at least one text hyperlink.

VBA Copy code Copy code
Sub SetHyperlinkTextToDisplay()
 With ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.Hyperlinks.Item(1)
 .TextToDisplay = "Tailspin Toys Web Site"
 .Address = "http://www.tailspintoys.com/"
 End With
End Sub


Story.Application Property (Publisher)

 Copy code hover
[image]

Story.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a Story object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Document.MasterPages Property (Publisher)

 Copy code hover
[image]

Document.MasterPages Property (Publisher)
Send feedback

Returns the MasterPages collection for the specified publication.

Syntax

expression .MasterPages

expression A variable that represents a Document object.

Return Value

MasterPages

Example

The following example sets the text in the first text frame on the master page to Second Quarter.

Copy code Copy code
Dim mp As MasterPages

Set mp = ActiveDocument.MasterPages

With mp.Item(1)
 .Shapes(1).TextFrame.TextRange.Text = "Second Quarter"
End With


Shapes.AddWebNavigationBar Method (Publisher)

 Copy code hover
[image]

Shapes.AddWebNavigationBar Method (Publisher)
Send feedback

Adds a Shape object of type pbWebNavigationBar to the current page of a publication.

Version Information

Version Added: Publisher 2007

Syntax

expression .AddWebNavigationBar(Name, Left, Top, Width)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the WebNavigationBarSet object to add to the specified Shape.
Left | Required | Variant | The position of the left edge of the shape that represents the Web navigation bar set.
Top | Required | Variant | The position of the top edge of the shape that represents the Web navigation bar set.
Width | Optional | Variant | The width of the shape that represents the Web navigation bar set.

Return Value

Shape

Remarks

The AddWebNavigationBar method does not create a Web navigation bar set. It adds an existing set from the WebNavigationBarSets collection. Pass the name of the existing Web navigation bar set as the Name parameter.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the AddWebNavigationBar method to add a WebNavigationBarSet object to the active document.

VBA Copy code Copy code
Public Sub AddWebNavigationBarSet_Example()

 Dim pubShape As Publisher.Shape

 ThisDocument.WebNavigationBarSets.AddSet ("NavBar")
 Set pubShape = ThisDocument.Pages(1).Shapes.AddWebNavigationBar("NavBar", 10, 25)

End Sub


PhoneticGuide.Application Property (Publisher)

 Copy code hover
[image]

PhoneticGuide.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a PhoneticGuide object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Application.InsertBarcodeVisible Property (Publisher)

 Copy code hover
[image]

Application.InsertBarcodeVisible Property (Publisher)
See also Send feedback

Determines whether Add a postal bar code is available under More Items on the Mail Merge and Catalog Merge task panes in the Microsoft Publisher user interface (UI); and whether Add postal bar codes is available under Prepare for Mailing on the Publisher Tasks task pane in the Publisher UI. Read/write.

Version Information

Version Added: Publisher 2007

Syntax

expression .InsertBarcodeVisible

expression A variable that represents an Application object.

Return Value

Boolean

See also

Concepts

Application Object

Other resources

Application Object Members


WebHiddenFields Methods (Publisher)

 Copy code hover
[image]

WebHiddenFields Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Add | Adds a new hidden field to a Web form and returns a Long indicating the number of the new field in the WebHiddenFields collection. New fields are always placed at the end of the current field list.
Delete | Deletes the specified hidden Web field or Web list box item object.
Item | Returns a String corresponding to the value of a hidden field in a Web form or a list item in a Web list box control.
Name | Returns a String that represents the name of a hidden Web field for a Web command button.


Hyperlink.Delete Method (Publisher)

 Copy code hover
[image]

Hyperlink.Delete Method (Publisher)
Send feedback

Deletes the specified object.

Syntax

expression .Delete

expression A variable that represents a Hyperlink object.

Remarks

A run-time error occurs if the specified object does not exist.


ColorFormat.CMYK Property (Publisher)

 Copy code hover
[image]

ColorFormat.CMYK Property (Publisher)
Send feedback

Returns a ColorCMYK object that represents CMYK color properties.

Syntax

expression .CMYK

expression A variable that represents a ColorFormat object.

Return Value

ColorCMYK

Example

This example creates two new shapes and then sets the CMYK fill color for one shape and sets the CMYK values of the second shape to the same CMYK values.

Copy code Copy code
Sub ReturnAndSetCMYK()
 Dim lngCyan As Long
 Dim lngMagenta As Long
 Dim lngYellow As Long
 Dim lngBlack As Long
 Dim shpHeart As Shape
 Dim shpStar As Shape

 Set shpHeart = ActiveDocument.Pages(1).Shapes.AddShape _
 (Type:=msoShapeHeart, Left:=100, _
 Top:=100, Width:=100, Height:=100)
 Set shpStar = ActiveDocument.Pages(1).Shapes.AddShape _
 (Type:=msoShape5pointStar, Left:=200, _
 Top:=100, Width:=150, Height:=150)

 With shpHeart.Fill.ForeColor.CMYK
 .SetCMYK 10, 80, 200, 30
 lngCyan = .Cyan
 lngMagenta = .Magenta
 lngYellow = .Yellow
 lngBlack = .Black
 End With

 'Sets new shape to current shape's CMYK colors
 shpStar.Fill.ForeColor.CMYK.SetCMYK _
 Cyan:=lngCyan, Magenta:=lngMagenta, _
 Yellow:=lngYellow, Black:=lngBlack
End Sub


MailMerge Object (Publisher)

 Copy code hover
[image]

MailMerge Object (Publisher)
Send feedback

Represents the mail merge and catalog merge functionality in Microsoft Publisher.

Example

Use the MailMerge property to return the MailMerge object. The MailMerge object is always available regardless of whether the mail merge or catalog merge operation has begun. The following example merges and prints the main publication with the first three records in the attached data source.

Copy code Copy code
Sub SelectiveMerge()
 Dim mrgMain As MailMerge
 Set mrgMain = ActiveDocument.MailMerge
 With mrgMain.DataSource
 .FirstRecord = 1
 .LastRecord = 3
 End With
 mrgMain.Execute True
End Sub


Using Events with the Application Object (Publisher)

 Copy code hover
[image]

Using Events with the Application Object (Publisher)
Send feedback

To create an event handler for an event of the Application object, you need to complete the following three steps:

  1. Declare an object variable in a class module to respond to the events.

  2. Write the specific event procedures.

  3. Initialize the declared object from another module.

Declare the Object Variable

Before you can write procedures for the events of the Application object, you must create a new class module and declare an object of type Application with events. For example, assume that a new class module is created and called EventClassModule. The new class module contains the following code.

Copy code Copy code
Public WithEvents App As Publisher.Application

Write the Event Procedures

After the new object has been declared with events, it appears in the Object drop-down list box in the class module, and you can write event procedures for the new object. (When you select the new object in the Object box, the valid events for that object are listed in the Procedure drop-down list box.) Select an event from the Procedure drop-down list box; an empty procedure is added to the class module.

Copy code Copy code
Private Sub App_DocumentOpen()

End Sub

Initialize the Declared Object

Before the procedure will run, you must connect the declared object in the class module (App in this example) with the Application object. You can do this with the following code from any module.

Copy code Copy code
Dim X As New EventClassModule
Sub Register_Event_Handler()
 Set X.App = Publisher.Application
End Sub

Run the Register_Event_Handler procedure. After the running procedure, the App object in the class module points to the Microsoft Publisher Application object, and the event procedures in the class module will run when the events occur.

Note Note

For information on creating event procedures for the Document object, see Using Events with the Document Object .


Shape.Delete Method (Publisher)

 Copy code hover
[image]

Shape.Delete Method (Publisher)
Send feedback

Deletes the specified object.

Syntax

expression .Delete

expression A variable that represents a Shape object.

Remarks

A run-time error occurs if the specified object does not exist.

Closing a mail merge data source deletes the shape that represents the catalog merge area of the publication page associated with the data source


Sections.Parent Property (Publisher)

 Copy code hover
[image]

Sections.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a Sections object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Shapes.AddCatalogMergeFieldToCanvas Method (Publisher)

 Copy code hover
[image]

Shapes.AddCatalogMergeFieldToCanvas Method (Publisher)
Send feedback

Adds a catalog merge field of the specified type to the canvas. Returns nothing.

Version Information

Version Added: Publisher 2010

Syntax

expression .AddCatalogMergeFieldToCanvas(CanvasId, CatalogMergeFieldType, DbCol)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
CanvasId | Required | [INT] | The ID of the canvas to which to add the catalog merge field.
CatalogMergeFieldType | Required | pbCatalogMergeFieldType | The type (picture or text) of the catalog merge field to add.
DbCol | Required | [INT] | The number of the column in the data source that contains the catalog merge information.


ConnectorFormat.BeginDisconnect Method (Publisher)

 Copy code hover
[image]

ConnectorFormat.BeginDisconnect Method (Publisher)
Send feedback

Detaches the beginning of the specified connector from the shape to which it is attached.

Syntax

expression .BeginDisconnect

expression A variable that represents a ConnectorFormat object.

Remarks

This method doesn't alter the size or position of the connector: the beginning of the connector remains positioned at a connection site but is no longer connected.

Use the EndDisconnect method to detach the end of the connector from a shape.

Example

This example adds two rectangles to the first page in the active publication, attaches them with a connector, automatically reroutes the connector along the shortest path, and then detaches the connector from the rectangles.

Copy code Copy code
Dim shpRect1 As Shape
Dim shpRect2 As Shape

With ActiveDocument.Pages(1).Shapes

 ' Add two new rectangles.
 Set shpRect1 = .AddShape(Type:=msoShapeRectangle, _
 Left:=100, Top:=50, Width:=200, Height:=100)
 Set shpRect2 = .AddShape(Type:=msoShapeRectangle, _
 Left:=300, Top:=300, Width:=200, Height:=100)

 ' Add a new connector.
 With .AddConnector(Type:=msoConnectorCurve, _
 BeginX:=0, BeginY:=0, EndX:=0, EndY:=0) _
 .ConnectorFormat

 ' Connect the new connector to the two rectangles.
 .BeginConnect ConnectedShape:=shpRect1, ConnectionSite:=1
 .EndConnect ConnectedShape:=shpRect2, ConnectionSite:=1

 ' Reroute the connector to create the shortest path.
 .Parent.RerouteConnections

 ' Disconnect the new connector from the rectangles but
 ' leave in place.
 .BeginDisconnect
 .EndDisconnect
 End With

End With


Pages.Parent Property (Publisher)

 Copy code hover
[image]

Pages.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a Pages object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


ColorCMYK Members (Publisher)

 Copy code hover
[image]

ColorCMYK Members (Publisher)
Send feedback

Represents a cyan-magenta-yellow-black (CMYK) color value.

Methods

Name | Description
SetCMYK | Sets a cyan-magenta-yellow-black (CMYK) color value.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Black | Sets or returns a Long that represents the black component of a CMYK color. Value can be any number between 0 and 255. Read/write.
Cyan | Sets or returns a Long that represents the cyan component of a CMYK color. Value can be any number between 0 and 255. Read/write.
Magenta | Sets or returns a Long that represents the magenta component of a CMYK color. Value can be any number between 0 and 255. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Yellow | Sets or returns a Long that represents the yellow component of a CMYK color. Value can be any number between 0 and 255. Read/write.


Cell.TextRange Property (Publisher)

 Copy code hover
[image]

Cell.TextRange Property (Publisher)
Send feedback

Returns a TextRange object that represents the text that is attached to a shape and properties and methods for manipulating the text.

Syntax

expression .TextRange

expression A variable that represents a Cell object.

Example

The following example adds text to the text frame of shape one in the active publication, and then formats the new text. This example assumes there is at least one shape on the first page of the active publication.

Copy code Copy code
Sub AddTextToTextFrame()
 With ActiveDocument.Pages(1).TextFrame.TextRange
 .Text = "My Text"
 With .Font
 .Bold = msoTrue
 .Size = 25
 .Name = "Arial"
 End With
 End With
End Sub

The following example adds a rectangle to the active publication and adds text to it.

Copy code Copy code
Sub AddTextToShape()
 With ActiveDocument.Pages(1).Shapes.AddShape(Type:=msoShapeRectangle, _
 Left:=72, Top:=72, Width:=250, Height:=140)
 .TextFrame.TextRange.Text = "Here is some test text"
 End With
End Sub


Rows Object (Publisher)

 Copy code hover
[image]

Rows Object (Publisher)
Send feedback

A collection of Row objects that represent the rows in a table.

Example

Use the Rows property of the Table object to return the Rows collection. The following example displays the number of Row objects in the Rows collection for the first table in the active document.

Copy code Copy code
Sub CountRows()
 MsgBox ActiveDocument.Pages(2).Shapes(1).Table.Rows.Count
End Sub

This example sets the fill for all even-numbered rows and clears the fill for all odd-numbered rows in the specified table. This example assumes the specified shape is a table and not another type of shape.

Copy code Copy code
Sub FillCellsByRow()
 Dim shpTable As Shape
 Dim rowTable As Row
 Dim celTable As Cell

 Set shpTable = ActiveDocument.Pages(2).Shapes(1)
 For Each rowTable In shpTable.Table.Rows
 For Each celTable In rowTable.Cells
 If celTable.Row Mod 2 = 0 Then
 celTable.Fill.ForeColor.RGB = RGB _
 (Red:=180, Green:=180, Blue:=180)
 Else
 celTable.Fill.ForeColor.RGB = RGB _
 (Red:=255, Green:=255, Blue:=255)
 End If
 Next celTable
 Next rowTable

End Sub

Use Rows(index), where index is the index number, to return a single Row object. The index number represents the position of the row in the Rows collection (counting from left to right). The following example selects the third row in the specified table.

Copy code Copy code
Sub SelectRows()
 ActiveDocument.Pages(2).Shapes(1).Table.Rows(3).Cells.Select
End Sub


ShapeRange.Type Property (Publisher)

 Copy code hover
[image]

ShapeRange.Type Property (Publisher)
Send feedback

Specifies the shape type. Read-only.

Syntax

expression .Type

expression A variable that represents a ShapeRange object.

Remarks

The Type property value can be one of the PbShapeType constants declared in the Microsoft Publisher type library.


AdvancedPrintOptions.NegativeImage Property (Publisher)

 Copy code hover
[image]

AdvancedPrintOptions.NegativeImage Property (Publisher)
See also Send feedback

True to print a negative image of the specified publication. The default is False. Read/write Boolean.

Syntax

expression .NegativeImage

expression A variable that represents a AdvancedPrintOptions object.

Return Value

Boolean

Remarks

This property is only accessible if the active printer is a PostScript printer. Returns a run-time error if a non-PostScript printer is specified. Use the IsPostscriptPrinter property of the AdvancedPrintOptions object to determine if the specified printer is a PostScript printer.

This property is saved as an application setting and applied to future instances of Microsoft Publisher.

This property corresponds to the Negative image control on the Page Settings tab of the Advanced Print Settings dialog box.

Example

The following example determines if the active printer is a PostScript printer. If it is, the active publication is set to print as a horizontally and vertically mirrored, negative image of itself.

Copy code Copy code
Sub PrepToPrintToFilmOnImagesetter()

With ActiveDocument.AdvancedPrintOptions
 If .IsPostscriptPrinter = True Then
 .HorizontalFlip = True
 .VerticalFlip = True
 .NegativeImage = True
 End If
End With

End Sub

See also

Concepts

AdvancedPrintOptions Object

Other resources

AdvancedPrintOptions Object Members


ReaderSpread Object (Publisher)

 Copy code hover
[image]

ReaderSpread Object (Publisher)
Send feedback

Represents the reader spread (not the printer spread) for the page. A reader spread generally contains one or two pages. The ReaderSpread object properties provide information about whether pages are facing and how those pages are laid out. For example, in facing page view, pages two and three can be side-by-side or one on top of the other.

Example

Use the ReaderSpread property to access the ReaderSpread object for a page. Use the PageCount property to determine if the reader spread includes one page or two facing pages. This example checks to see if the reader spread includes less than two pages. If it does, it changes the reader spread to include two pages.

Copy code Copy code
Sub SetFacingPages()
 With ActiveDocument
 If .Pages.Count >= 2 Then
 If .Pages(2).ReaderSpread.PageCount < 2 Then _
 .ViewTwoPageSpread = True
 End If
 End With
End Sub


Application.InchesToPoints Method (Publisher)

 Copy code hover
[image]

Application.InchesToPoints Method (Publisher)
See also Send feedback

Converts a measurement from inches to points (1 inch = 72 points). Returns the converted measurement as a Single.

Syntax

expression .InchesToPoints(Value)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Value | Required | Single | The inches value to be converted to points.

Return Value

Single

Remarks

Use the PointsToInches method to convert measurements in points to inches.

Example

This example converts measurements in inches entered by the user to measurements in points.

Copy code Copy code
Dim strInput As String
Dim strOutput As String

Do While True
 ' Get input from user.
 strInput = InputBox( _
 Prompt:="Enter measurement in inches (0 to cancel): ", _
 Default:="0")

 ' Exit the loop if user enters zero.
 If Val(strInput) = 0 Then Exit Do

 ' Evaluate and display result.
 strOutput = Trim(strInput) & " in = " _
 & Format(Application _
 .InchesToPoints(Value:=Val(strInput)), _
 "0.00") & " points"

 MsgBox strOutput
Loop

See also

Concepts

Application Object

Other resources

Application Object Members


ParagraphFormat.SetLineSpacing Method (Publisher)

 Copy code hover
[image]

ParagraphFormat.SetLineSpacing Method (Publisher)
Send feedback

Formats the line spacing of specified paragraphs.

Syntax

expression .SetLineSpacing(Rule, Spacing)

expression A variable that represents a ParagraphFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Rule | Required | PbLineSpacingRule | The line spacing to use for the specified paragraphs.
Spacing | Optional | Variant | The spacing (in points) for the specified paragraphs.

Remarks

The Rule parameter can be one of the PbLineSpacingRule constants declared in the Microsoft Publisher type library and shown in the following table.

Constant | Description
pbLineSpacing1pt5 | Sets the spacing for specified paragraphs to one-and-a-half lines.
pbLineSpacingDouble | Double-spaces the specified paragraphs.
pbLineSpacingExactly | Sets the line spacing to exactly the value specified in the Spacing argument, even if a larger font is used within the paragraph.
pbLineSpacingMixed | A return value for the LineSpacing property that indicates that line spacing is a combination of values for the specified paragraphs.
pbLineSpacingMultiple | Sets the line spacing to the value specified in the Spacing argument.
pbLineSpacingSingle | Single spaces the specified paragraphs.

Example

This example sets the line spacing to double.

VBA Copy code Copy code
Sub SetLineSpacingForSelection()
 Selection.TextRange.ParagraphFormat.SetLineSpacing _
 Rule:=pbLineSpacingDouble, Spacing:=12
End Sub


WebTextBox.RequiredControl Property (Publisher)

 Copy code hover
[image]

WebTextBox.RequiredControl Property (Publisher)
Send feedback

Specifies whether an entry into a Web text box control is required. Read/write.

Syntax

expression .RequiredControl

expression A variable that represents a WebTextBox object.

Return Value

MsoTriState

Remarks

The RequiredControl property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | Indicates entry into the specified Web text box control is not required.
msoTrue | Indicates entry into the specified Web text box control is required.

Example

This example creates a new Web text box control in the active publication, sets the default text and the character limit for the text box, and specifies that an entry is required.

VBA Copy code Copy code
Sub AddWebTextBoxControl()
 With ActiveDocument.Pages(1).Shapes.AddWebControl _
 (Type:=pbWebControlMultiLineTextBox, Left:=72, _
 Top:=72, Width:=300, Height:=100).WebTextBox
 .DefaultText = "Please enter text here."
 .Limit = 200
 .RequiredControl = msoTrue
 End With
End Sub


ShapeRange.IsInline Property (Publisher)

 Copy code hover
[image]

ShapeRange.IsInline Property (Publisher)
Send feedback

Returns an MsoTriState constant that specifies whether a shape is inline. Read-only.

Syntax

expression .IsInline

expression A variable that represents a ShapeRange object.

Example

This example tests the first shape (a text frame) on the first page of the publication to see if it is inline. If it is not, a search is done within that shape to find any inline shapes within the text frame. Any inline shapes that are found have the ForeColor property set to red.

VBA Copy code Copy code
Dim theShape As Shape
Dim i As Integer

Set theShape = ActiveDocument.Pages(1).Shapes(1)

If Not theShape.IsInline = True Then
 With theShape.TextFrame.Story.TextRange
 If .InlineShapes.Count > 0 Then
 For i = 1 To .InlineShapes.Count
 .InlineShapes(i).Select
 .InlineShapes(i).Fill.ForeColor.RGB = vbRed
 Next
 End If
 End With
End If


Document.AdvancedPrintOptions Property (Publisher)

 Copy code hover
[image]

Document.AdvancedPrintOptions Property (Publisher)
Send feedback

Returns an AdvancedPrintOptions object that represents the advanced print settings for a publication. Read-only.

Syntax

expression .AdvancedPrintOptions

expression A variable that represents a Document object.

Return Value

AdvancedPrintOptions

Remarks

The properties of the AdvancedPrintOptions object correspond to the options in the Advanced Print Settings dialog box.

Example

The following example tests to determine if the active publication has been set to print as separations. If it has, it is set to print only plates for the inks actually used in the publication, and to not print plates for any pages where a color is not used.

Copy code Copy code
Sub PrintOnlyInksUsed
 With ActiveDocument.AdvancedPrintOptions
 If .PrintMode = pbPrintModeSeparations Then
 .InksToPrint = pbInksToPrintUsed
 .PrintBlankPlates = False
 End If
 End With
End Sub


Attachment Properties (Publisher)

 Copy code hover
[image]

Attachment Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Name | Returns the name of the attachment. Read-only.


PictureFormat.EffectiveResolution Property (Publisher)

 Copy code hover
[image]

PictureFormat.EffectiveResolution Property (Publisher)
Send feedback

Returns a Long that represents, in dots per inch (dpi), the effective resolution of the picture. Read-only.

Syntax

expression .EffectiveResolution

expression A variable that represents an PictureFormat object.

Return Value

Long

Remarks

The effective resolution of a picture is inversely proportional to the scaling at which the picture is printed. The larger the scaling, the lower the effective resolution. For example, suppose a picture measuring 4 inches by 4 inches was originally scanned at 300 dpi. If that picture is scaled to 2 inches by 2 inches, its effective resolution is 600 dpi.

Use the OriginalResolution property of the PictureFormat object to determine the resolution of linked pictures or OLE objects. Use the HorizontalScale and VerticalScale properties to determine the scaling of a picture.

Example

The following example returns a list of pictures whose effective resolution falls below a specified threshold (100 dpi) in the active publication.

Copy code Copy code
Sub ListLowResolutionPictures()
 Dim pgLoop As Page
 Dim shpLoop As Shape

 For Each pgLoop In ActiveDocument.Pages
 For Each shpLoop In pgLoop.Shapes

 If shpLoop.Type = pbPicture Or shpLoop.Type = pbLinkedPicture Then

 With shpLoop.PictureFormat
 If .IsEmpty = msoFalse Then
 If .EffectiveResolution < 100 Then
 Debug.Print .Filename
 Debug.Print "Page " & pgLoop.PageNumber
 Debug.Print "Resolution in publication: " & .EffectiveResolution
 End If
 End If
 End With

 End If

 Next shpLoop
 Next pgLoop

End Sub


WizardProperties Properties (Publisher)

 Copy code hover
[image]

WizardProperties Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Item | Returns an individual object from a specified collection. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


ReaderSpread Members (Publisher)

 Copy code hover
[image]

ReaderSpread Members (Publisher)
Send feedback

Represents the reader spread (not the printer spread) for the page. A reader spread generally contains one or two pages. The ReaderSpread object properties provide information about whether pages are facing and how those pages are laid out. For example, in facing page view, pages two and three can be side-by-side or one on top of the other.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Height | Returns a Single that represents the height, in points, of the page. Read-only.
Left | Returns a Single indicating the position (in points) of the left edge of the reader spread from the workspace. Read-only.
PageCount | Returns a Long indicating the number of pages in the specified reader spread. Read-only.
Pages | Returns a Page object representing one of the pages that compose the specified reader spread.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Top | Returns the a Single that represents the distance (in points) from the top edge of the workspace to the top edge of the page. Read-only.
Width | Returns a Single that represents the width, in points, of the page. Read-only.


WebPageOptions.BackgroundSoundLoopCount Property (Publisher)

 Copy code hover
[image]

WebPageOptions.BackgroundSoundLoopCount Property (Publisher)
Send feedback

Returns a Long value that specifies the number of times the background sound attached to a Web page is played when the page is loaded in a Web browser. Read-only.

Syntax

expression .BackgroundSoundLoopCount

expression A variable that represents a WebPageOptions object.

Return Value

Long

Remarks

The SetBackgroundSoundRepeat method can be used to specify the number of times the background sound file is played when the page is loaded. If using the SetBackgroundSoundRepeat method to specify the number of times the background file is played, the BackgroundSoundLoopCount property will be equal to that specified value. Note that valid values range from 1 to 999, inclusive. Attempting to set this value outside this range will result in a run-time error.

Until the SetBackgroundSoundRepeat method is used to change the number of times the background sound file is played, BackgroundSoundLoopCount is 1.

Example

The following example sets the background sound for page four of the active Web publication to a .wav file on the local computer. If BackgroundSoundLoopCount is less than three, the SetBackgroundSoundRepeat method is used to specify that the background sound be repeated three times. The BackgroundSoundLoopCount property will now be three.

Copy code Copy code
Dim theWPO As WebPageOptions

Set theWPO = ActiveDocument.Pages(4).WebPageOptions

With theWPO
 .BackgroundSound = "C:\CompanySounds\corporate_jingle.wav"
 If .BackgroundSoundLoopCount < 3 Then
 .SetBackgroundSoundRepeat RepeatForever:=False, RepeatTimes:=3
 End If
End With


Rows.Add Method (Publisher)

 Copy code hover
[image]

Rows.Add Method (Publisher)
Send feedback

Adds a new Row object to the specified Rows collection and returns the new Row object.

Syntax

expression .Add(BeforeRow)

expression A variable that represents a Rows object.

Parameters

Name | Required/Optional | Data Type | Description
BeforeRow | Optional | Long | The number of the row before which to insert the new row. If this argument is omitted, the new row is added after the existing rows. An error occurs if the value of this argument does not correspond to an existing row in the table.

Return Value

Row

Example

The following example adds a row before row three in the specified table.

VBA Copy code Copy code
Dim rowNew As Row

Set rowNew = ActiveDocument.Pages(1).Shapes(1) _
 .Table.Rows.Add(BeforeRow:=3)


PictureFormat.ColorsInPalette Property (Publisher)

 Copy code hover
[image]

PictureFormat.ColorsInPalette Property (Publisher)
Send feedback

Returns a Long that represents the number of colors in the picture's palette. Read-only.

Syntax

expression .ColorsInPalette

expression A variable that represents a PictureFormat object.

Return Value

Long

Remarks

This property applies only to pictures that are not TrueColor (that is, pictures that contain color data of less than 24 bits per channel). Returns "Permission Denied" for shapes representing pictures that are TrueColor.

Use the IsTrueColor property of the PictureFormat object to determine whether a picture contains color data of 24 bits per channel or greater.

Example

The following example tests each picture in the active document and prints whether the picture is TrueColor. If the picture is not TrueColor, the example prints how many colors are in the picture's palette.

Copy code Copy code
For Each pgLoop In ActiveDocument.Pages
 For Each shpLoop In pgLoop.Shapes
 If shpLoop.Type = pbLinkedPicture Or shpLoop.Type = pbPicture Then

 With shpLoop.PictureFormat
 If .IsEmpty = msoFalse Then
 Debug.Print .Filename
 If .IsTrueColor = msoTrue Then
 Debug.Print "This picture is TrueColor"
 Else
 Debug.Print "This picture contains " & .ColorsInPalette & " colors."
 End If
 End If
 End With

 End If
 Next shpLoop
Next pgLoop


ShapeRange.Hyperlink Property (Publisher)

 Copy code hover
[image]

ShapeRange.Hyperlink Property (Publisher)
Send feedback

Returns a Hyperlink object representing the hyperlink associated with the specified shape.

Syntax

expression .Hyperlink

expression A variable that represents a ShapeRange object.

Example

This example sets shape one on page one in the active publication to jump to the specified Web site when the shape is clicked.

Copy code Copy code
Dim hypTemp As Hyperlink

Set hypTemp = ActiveDocument.Pages(1).Shapes(1).Hyperlink

hypTemp.Address = "http://www.tailspintoys.com/"


Columns.Application Property (Publisher)

 Copy code hover
[image]

Columns.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a Columns object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Application.Path Property (Publisher)

 Copy code hover
[image]

Application.Path Property (Publisher)
See also Send feedback

Returns a String indicating the full path to the file of the saved active publication, not including the last separator or file name.

Syntax

expression .Path

expression A variable that represents an Application object.

Remarks

The FullName property can be used to return both the path and file name.

Example

The following example demonstrates the differences between the Path, Name, and FullName properties. This example is best illustrated if the publication is saved in a folder other than the default.

Copy code Copy code
Sub PathNames()

 Dim strPath As String
 Dim strName As String
 Dim strFullName As String

 strPath = Application.ActiveDocument.Path
 strName = Application.ActiveDocument.Name
 strFullName = Application.ActiveDocument.FullName

 ' Note the file name & path differences
 ' while executing.
 MsgBox "The path is: " & strPath
 MsgBox "The file name is: " & strName
 MsgBox "The path & file name are: " & strFullName

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Shape.OLEFormat Property (Publisher)

 Copy code hover
[image]

Shape.OLEFormat Property (Publisher)
Send feedback

Returns an OLEFormat object that contains OLE formatting properties for the specified shape. Applies to Shape or ShapeRange objects that represent OLE objects.

Syntax

expression .OLEFormat

expression A variable that represents a Shape object.

Example

This example loops through all the shapes on the first page of the active document and automatically updates all linked Excel worksheets.

Copy code Copy code
Sub UpdateLinkedExcelSpreadsheets()
 Dim shp As Shape
 For Each shp In ActiveDocument.Pages(1).Shapes
 If shp.Type = msoLinkedOLEObject Then
 If shp.OLEFormat.ProgId = "Excel.Sheet" Then
 shp.LinkFormat.Update
 End If
 End If
 Next shp
End Sub


WebOptionButton.Application Property (Publisher)

 Copy code hover
[image]

WebOptionButton.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a WebOptionButton object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


ShapeRange.MoveOutOfTextFlow Method (Publisher)

 Copy code hover
[image]

ShapeRange.MoveOutOfTextFlow Method (Publisher)
Send feedback

Moves a given inline shape out of its containing text range, defined by TextRange Object, and makes the shape fixed.

Syntax

expression .MoveOutOfTextFlow

expression A variable that represents a ShapeRange object.

Return Value

Nothing

Remarks

An automation error is returned if the shape to be moved is not already inline.

After the MoveOutOfTextFlow method is called on an inline shape, the shape will maintain its position on the page, but it will no longer be inline.

Example

The following example moves the first inline shape contained in a given text range out of the text flow.

Copy code Copy code
Dim theShape As Shape

Set theShape = ActiveDocument.Pages(2).Shapes(1) _
 .TextFrame.TextRange.InlineShapes(1)

theShape.MoveOutOfTextFlow


LinkFormat.Application Property (Publisher)

 Copy code hover
[image]

LinkFormat.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a LinkFormat object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Cell.Select Method (Publisher)

 Copy code hover
[image]

Cell.Select Method (Publisher)
Send feedback

Selects the specified object.

Syntax

expression .Select

expression A variable that represents a Cell object.

Example

This example selects the upper-left cell from a table that has been added to the first page in the active publication.

VBA Copy code Copy code
Dim shpTable As Shape
Dim cllTemp As Cell

With ActiveDocument.Pages(1).Shapes
 Set shpTable = .AddTable(NumRows:=3, NumColumns:=3, _
 Left:=100, Top:=100, Width:=150, Height:=150)
 Set cllTemp = shpTable.Table.Cells.Item(1)
 cllTemp.Select
End With

This example selects the first column from a table that has been added to the first page in the active publication.

VBA Copy code Copy code
Dim shpTable As Shape
Dim crTemp As CellRange

With ActiveDocument.Pages(1).Shapes
 Set shpTable = .AddTable(NumRows:=3, NumColumns:=3, _
 Left:=100, Top:=100, Width:=150, Height:=150)
 Set crTemp = shpTable.Table.Cells(StartRow:=1, _
 StartColumn:=1, EndRow:=3, EndColumn:=1)
 crTemp.Select
End With

This example selects the first five characters in shape one on page one of the active publication.

VBA Copy code Copy code
ActiveDocument.Pages(1).Shapes(1).TextFrame _
 .TextRange.Characters(1, 5).Select


Application.Help Method (Publisher)

 Copy code hover
[image]

Application.Help Method (Publisher)
See also Send feedback

Displays online Help information.

Syntax

expression .Help(HelpType)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
HelpType | Required | PbHelpType | The type of help to display.

Remarks

The HelpType parameter can be one of the following PbHelpType constants declared in the Microsoft Publisher type library.

Constant | Description
pbHelp | Displays the Help Topics dialog box.
pbHelpActiveWindow | Displays Help describing the command associated with the active view or pane.
pbHelpPSSHelp | Displays product support information.

Some of the constants listed above may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

Example

This example displays a list of topics for troubleshooting printing problems.

VBA Copy code Copy code
Sub ShowPrintTroubleshooter()
 Application.Help (HelpType:=pbHelpPrintTroubleshooter)
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


PbSchemeColorIndex Enumeration (Publisher)

 Copy code hover
[image]

PbSchemeColorIndex Enumeration (Publisher)
Send feedback

Represents the specified color of the current color scheme.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbSchemeColorAccent1 | 2 | Sets the color to Accent1 scheme color.
pbSchemeColorAccent2 | 3 | Sets the color to Accent2 scheme color.
pbSchemeColorAccent3 | 4 | Sets the color to Accent3 scheme color.
pbSchemeColorAccent4 | 5 | Sets the color to Accent4 scheme color.
pbSchemeColorAccent5 | 8 | Sets the color to Accent5 scheme color.
pbSchemeColorFollowedHyperlink | 7 | Sets the color scheme to followed hyperlink.
pbSchemeColorHyperlink | 6 | Sets the color scheme to color hyperlink.
pbSchemeColorMain | 1 | Sets the color to main.
pbSchemeColorNone | 0 | Sets the color scheme to none.


EmailMergeEnvelope Properties (Publisher)

 Copy code hover
[image]

EmailMergeEnvelope Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the creator of the parent EmailMergeEnvelope object. Read-only.
Attachemts | Gets the list of a merged e-mail message's attachments. Read-only.
Bcc | Gets or sets a semicolon-delimited list of e-mail addresses that receive a blind carbon copy (BCC) of the e-mail message. Read/write.
Cc | Gets or sets the MailMergeDataField object that represents the data-source field (column) that lists the e-mail addresses of recipients you want to receive a carbon copy (CC) of the merged e-mail message. Read/write.
Parent | Returns the parent of the EmailMergeEnvelope object. Read-only.
Priority | Gets or sets the priority of the merged e-mail message represented by the parent EmailMergeEnvelope object. Read/write.
Subject | Gets or sets the subject line of the merged e-mail message. Read/write.
To | Gets or sets the MailMergeDataField object that represents the data-source field (column) that lists the e-mail addresses of recipients of the merged e-mail message. Read/write.


FillFormat.GradientStyle Property (Publisher)

 Copy code hover
[image]

FillFormat.GradientStyle Property (Publisher)
Send feedback

Returns an MsoGradientStyle constant indicating the gradient style for the specified fill. Read-only.

Syntax

expression .GradientStyle

expression A variable that represents a FillFormat object.

Return Value

MsoGradientStyle

Remarks

Use the OneColorGradient , PresetGradient , or TwoColorGradient method to set the gradient style for the fill.

Attempting to return this property for a fill that doesn't have a gradient generates an error. Use the Type property to determine whether the fill has a gradient.

The GradientStyle property value can be one of the MsoGradientStyle constants declared in the Microsoft Office type library.

Example

This example adds a rectangle to the active publication and sets its fill gradient style to match that of the shape named rect1. For the example to work, rect1 must have a gradient fill.

VBA Copy code Copy code
Dim intStyle As Integer

With ActiveDocument.Pages(1).Shapes
 ' Store gradient style of rect1.
 intStyle = .Item("rect1").Fill.GradientStyle
 ' Add new rectangle.
 With .AddShape(Type:=msoShapeRectangle, _
 Left:=0, Top:=0, Width:=40, Height:=80).Fill
 ' Set color and gradient of new rectangle.
 .ForeColor.RGB = RGB(128, 0, 0)
 .OneColorGradient Style:=intStyle, _
 Variant:=1, Degree:=1
 End With
End With


Sections.Count Property (Publisher)

 Copy code hover
[image]

Sections.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a Sections object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


ReaderSpread.PageCount Property (Publisher)

 Copy code hover
[image]

ReaderSpread.PageCount Property (Publisher)
Send feedback

Returns a Long indicating the number of pages in the specified reader spread. Read-only.

Syntax

expression .PageCount

expression A variable that represents a ReaderSpread object.

Return Value

Long

Remarks

A reader spread can contain no more than two pages.

Example

The following example checks the reader spread of the third page in the active publication to see if it contains more than one page, then displays the total number of pages in the spread.

VBA Copy code Copy code
Sub NumberOfPagesInSpread()
 If ActiveDocument.Pages(3).ReaderSpread.PageCount > 1 Then
 MsgBox "The spread has two pages."
 Else
 MsgBox "The spread has only one page."
 End If
End Sub


FillFormat.ForeColor Property (Publisher)

 Copy code hover
[image]

FillFormat.ForeColor Property (Publisher)
Send feedback

Returns or sets a ColorFormat object representing the foreground color for the fill, line, or shadow. Read/write.

Syntax

expression .ForeColor

expression A variable that represents a FillFormat object.

Remarks

Use the BackColor property to set the background color for a fill or line.

Example

This example adds a rectangle to the active publication and then sets the foreground color, background color, and gradient for the rectangle's fill.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes.AddShape _
 (Type:=msoShapeRectangle, _
 Left:=90, Top:=90, Width:=90, Height:=50).Fill
 .ForeColor.RGB = RGB(128, 0, 0)
 .BackColor.RGB = RGB(170, 170, 170)
 .TwoColorGradient msoGradientHorizontal, 1
End With

This example adds a patterned line to the active publication.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes.AddLine _
 (BeginX:=10, BeginY:=100, EndX:=250, EndY:=0).Line
 .Weight = 6
 .ForeColor.RGB = RGB(0, 0, 255)
 .BackColor.RGB = RGB(128, 0, 0)
 .Pattern = msoPatternDarkDownwardDiagonal
End With


WebOptionButton.Selected Property (Publisher)

 Copy code hover
[image]

WebOptionButton.Selected Property (Publisher)
Send feedback

Specifies whether a Web check box or option button is selected. Read/write.

Syntax

expression .Selected

expression A variable that represents a WebOptionButton object.

Remarks

The Selected property value can be one of the MsoTriState constants declared in the Microsoft Office type library.


WizardValues.Application Property (Publisher)

 Copy code hover
[image]

WizardValues.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a WizardValues object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


FillFormat.TextureAlignment Property (Publisher)

 Copy code hover
[image]

FillFormat.TextureAlignment Property (Publisher)
See also Send feedback

Returns or sets the alignment (the origin of the coordinate grid) for the tiling of the texture fill. Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .TextureAlignment

expression A variable that represents a FillFormat object.

Property value

MSOTEXTUREALIGNMENT

Remarks

The value returned by the TextureAlignment property can be one of the following MsoTextureAlignment constants:

  • msoTextureTopLeft

  • msoTextureTop

  • msoTextureTopRight

  • msoTextureLeft

  • msoTextureCenter

  • msoTextureRight

  • msoTextureBottomLeft

  • msoTextureBottom

  • msoTextureBottomRight

The setting of the TextureAlignment property corresponds to the Alignment setting on the Fill tab of the Format Shape dialog box in the Publisher 2013 user interface.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


Shape.InlineTextRange Property (Publisher)

 Copy code hover
[image]

Shape.InlineTextRange Property (Publisher)
Send feedback

Returns a TextRange object that reflects the position of the inline shape in its containing text range. Read-only.

Syntax

expression .InlineTextRange

expression A variable that represents a Shape object.

Remarks

The returned text range will contain a single object representing the inline shape. An automation error is returned if the shape is not inline.

Example

The following example finds the first shape (a text box) on the first page of the publication, and determines if the text range within the text box contains inline shapes. If inline shapes are found, the InlineTextRange property is used to represent the inline shape after a block of text is inserted.

Copy code Copy code
Dim theShape As Shape
Dim theTextRange As TextRange
Dim i As Integer

Set theShape = ActiveDocument.Pages(1).Shapes(1)

If Not theShape.IsInline = True Then
 With theShape.TextFrame.Story.TextRange
 If .InlineShapes.Count > 0 Then
 Set theTextRange = theShape.TextFrame.Story.TextRange
 For i = 1 To .InlineShapes.Count
 With .InlineShapes(i)
 .InlineTextRange.InsertAfter (" (Figure " & i & ") ")
 End With
 Next
 End If
 End With
End If


Shape.Vertices Property (Publisher)

 Copy code hover
[image]

Shape.Vertices Property (Publisher)
Send feedback

Returns the coordinates of the specified freeform drawing's vertices (and control points for Bézier curves) as a series of coordinate pairs. Read-only Variant.

Syntax

expression .Vertices

expression A variable that represents a Shape object.

Remarks

You can use the array returned by this property as an argument to the AddCurve or AddPolyline methods.

The following table shows how the Vertices property associates the values in the array vertArray() with the coordinates of a triangle's vertices.

vertArray element | Contains
vertArray(1, 1) | The horizontal distance from the first vertex to the left side of the page.
vertArray(1, 2) | The vertical distance from the first vertex to the top of the page.
vertArray(2, 1) | The horizontal distance from the second vertex to the left side of the page.
vertArray(2, 2) | The vertical distance from the second vertex to the top of the page.
vertArray(3, 1) | The horizontal distance from the third vertex to the left side of the page.
vertArray(3, 2) | The vertical distance from the third vertex to the top of the page.

Example

This example assigns the vertex coordinates for shape one in the active publication to the array variable vertArray() and displays the coordinates for the first vertex.

VBA Copy code Copy code
Dim vertArray As Variant
Dim sngX1 As Single
Dim sngY1 As Single

With ActiveDocument.Pages(1).Shapes(1)
 vertArray = .Vertices
 sngX1 = vertArray(1, 1)
 sngY1 = vertArray(1, 2)
 MsgBox "First vertex coordinates: " & sngX1 & ", " & sngY1
End With

This example creates a curve that has the same geometric description as shape one in the active publication. Shape one must contain 3n+1 vertices for this example to work, where n is an integer greater than or equal to 1.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes
 .AddCurve SafeArrayOfPoints:=.Item(1).Vertices
End With


Application.MillimetersToPoints Method (Publisher)

 Copy code hover
[image]

Application.MillimetersToPoints Method (Publisher)
See also Send feedback

Converts a measurement from millimeters to points (1 mm = 2.835 points). Returns the converted measurement as a Single.

Syntax

expression .MillimetersToPoints(Value)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Value | Required | Single | The millimeter value to be converted to points.

Return Value

Single

Remarks

Use the PointsToMillimeters method to convert measurements in points to millimeters.

Example

This example converts measurements in millimeters entered by the user to measurements in points.

Copy code Copy code
Dim strInput As String
Dim strOutput As String

Do While True
 ' Get input from user.
 strInput = InputBox( _
 Prompt:="Enter measurement in millimeters (0 to cancel): ", _
 Default:="0")

 ' Exit the loop if user enters zero.
 If Val(strInput) = 0 Then Exit Do

 ' Evaluate and display result.
 strOutput = Trim(strInput) & " mm = " _
 & Format(Application _
 .Mill imetersToPoints(Value:=Val(strInput)), _
 "0.00") & " points"

 MsgBox strOutput
Loop

See also

Concepts

Application Object

Other resources

Application Object Members


ShapeRange.TextWrap Property (Publisher)

 Copy code hover
[image]

ShapeRange.TextWrap Property (Publisher)
Send feedback

Returns a WrapFormat object that represents the properties for wrapping text around a shape or shape range.

Syntax

expression .TextWrap

expression A variable that represents a ShapeRange object.

Example

The following example adds an oval to the active publication and specifies that publication text wrap around the left and right sides of the square that circumscribes the oval. There will be a 0.1-inch margin between the publication text and the top, bottom, left side, and right side of the square.

Copy code Copy code
Sub SetTextWrapFormatProperties()
 Dim shpOval As Shape

 Set shpOval = ActiveDocument.Pages(1).Shapes.AddShape(Type:=msoShapeOval, _
 Left:=36, Top:=36, Width:=100, Height:=35)
 With shpOval.TextWrap
 .Type = pbWrapTypeSquare
 .Side = pbWrapSideBoth
 .DistanceAuto = msoFalse
 .DistanceTop = InchesToPoints(0.1)
 .DistanceBottom = InchesToPoints(0.1)
 .DistanceLeft = InchesToPoints(0.1)
 .DistanceRight = InchesToPoints(0.1)
 End With
End Sub


Documents.Application Property (Publisher)

 Copy code hover
[image]

Documents.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a Documents object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


WizardProperty.Application Property (Publisher)

 Copy code hover
[image]

WizardProperty.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a WizardProperty object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Font.Grow Method (Publisher)

 Copy code hover
[image]

Font.Grow Method (Publisher)
Send feedback

Increases the font size to the next available size.

Syntax

expression .Grow

expression A variable that represents a Font object.

Remarks

If the selection or range contains more than one font size, each size is increased to the next available setting.

Example

This example increases the font size of the fourth word in a new textbox.

Copy code Copy code
Sub GrowFont()
 Dim shpText As Shape
 Dim intResponse As Integer

 Set shpText = ActiveDocument.Pages(1).Shapes.AddTextbox( _
 Orientation:=pbTextOrientationHorizontal, Left:=100, _
 Top:=100, Width:=200, Height:=100)

 With shpText.TextFrame.TextRange
 .Text = "This is a test of the Grow method."
 Do Until intResponse = vbNo
 intResponse = MsgBox("Do you want to increase the " & _
 "size of the font?", vbYesNo)
 If intResponse = vbYes Then
 .Words(4).Font.Grow
 End If
 Loop
 End With
End Sub

This example increases the font size of the selected text.

Copy code Copy code
Sub IncreaseFontSizeOfSelectedText()
 If Selection.Type = pbSelectionText Then
 Selection.TextRange.Font.Grow
 Else
 MsgBox "You need to select some text."
 End If
End Sub


WrapFormat Properties (Publisher)

 Copy code hover
[image]

WrapFormat Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
DistanceAuto | Returns or sets an MsoTriState constant indicating whether an appropriate distance between an inline shape and any surrounding text is automatically calculated. Read/write.
DistanceBottom | When the Type property of the WrapFormat object is set to pbWrapTypeSquare, returns or sets a Variant that represents the distance (in points) between the document text and the bottom edge of the specified shape. Read/write.
DistanceLeft | When the Type property of the WrapFormat object is set to pbWrapTypeSquare, returns or sets a Variant that represents the distance (in points) between the document text and the left edge of the specified shape. Read/write.
DistanceRight | When the Type property of the WrapFormat object is set to pbWrapTypeSquare, returns or sets a Variant that represents the distance (in points) between the document text and the right edge of the specified shape. Read/write.
DistanceTop | When the Type property of the WrapFormat object is set to pbWrapTypeSquare, returns or sets a Variant that represents the distance (in points) between the document text and the top edge of the specified shape. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Side | Returns or sets a PbWrapSideType constant that indicates whether text should wrap around a shape. Read/write.
Type | Specifies how text wraps around the specified shape. Read/write.


Page.XOffsetWithinReaderSpread Property (Publisher)

 Copy code hover
[image]

Page.XOffsetWithinReaderSpread Property (Publisher)
Send feedback

Returns a Single that represents the distance (in points) from the left edge of the reader spread to the left edge of the page. Read-only.

Syntax

expression .XOffsetWithinReaderSpread

expression A variable that represents a Page object.

Return Value

Single

Example

This example creates a shape on the second and third pages of the active publication and then sets the position of the shape on the third page to the diagonally opposite corner of the page from the shape on the second page. For this example to work, the active publication must have at least three pages.

VBA Copy code Copy code
Sub OffsetShapePositions()
 Dim shpOne As Shape
 Dim intLeft As Integer
 Dim intTop As Integer
 Dim intWidth As Integer
 Dim intHeight As Integer

 With ActiveDocument
 .ViewTwoPageSpread = True

 With .Pages
 intWidth = 150
 intHeight = 150
 intLeft = (.Item(2).Width / 2) - intWidth
 intTop = InchesToPoints(7)

 Set shpOne = .Item(2).Shapes.AddShape _
 (Type:=msoShape5pointStar, Left:=intLeft, _
 Top:=intTop, Width:=intWidth, Height:=intHeight)

 intLeft = (.Item(3).XOffsetWithinReaderSpread - _
 .Item(2).XOffsetWithinReaderSpread) + (.Item(2) _
 .Width - shpOne.Left - shpOne.Width)
 intTop = (.Item(3).YOffsetWithinReaderSpread - _
 .Item(2).YOffsetWithinReaderSpread) + (.Item(2) _
 .Height - shpOne.Top - shpOne.Height)

 .Item(2).Shapes.AddShape Type:=msoShape5pointStar, _
 Left:=intLeft, Top:=intTop, Width:=intWidth, _
 Height:=intHeight
 End With
 End With
End Sub


PictureFormat.Recolor Method (Publisher)

 Copy code hover
[image]

PictureFormat.Recolor Method (Publisher)
Send feedback

Changes the color of a picture in a publication.

Version Information

Version Added: Publisher 2007

Syntax

expression .Recolor(Color, LeaveBlackPartsBlack)

expression A variable that represents a PictureFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Color | Required | ColorFormat | The color to be used for recoloring.
LeaveBlackPartsBlack | Required | MsoTriState | True if all parts of the original picture that were black in color should be left black.

Remarks

The Recolor method corresponds to the options available in the Recolor Picture dialog box. (On the Format menu, click Picture, and then click Recolor)

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the Recolor method to change the color of a picture. It recolors the first shape in the Shapes collection on the first page of the publication. After running the code, you can restore the original colors by using the RestoreOriginalColors method.

For this example to work, the shape to be recolored must be either a picture or an OLE object that represents a picture.

VBA Copy code Copy code
Public Sub Recolor_Example()

 Dim pubPictureFormat As Publisher.PictureFormat
 Dim pubShape As Publisher.Shape
 Dim pubColorFormat As Publisher.ColorFormat

 Set pubShape = ThisDocument.Pages(1).Shapes(1)

 Set pubPictureFormat = pubShape.PictureFormat
 Set pubColorFormat = pubShape.Fill.BackColor

 pubPictureFormat.Recolor pubColorFormat, msoTrue

End Sub


WebOptions.EnableIncrementalUpload Property (Publisher)

 Copy code hover
[image]

WebOptions.EnableIncrementalUpload Property (Publisher)
Send feedback

Returns or sets a Boolean value that specifies whether changes made to a Web publication can be uploaded to a Web server independent of the entire publication. If True, only changes made to a publication will be uploaded to the Web server when published. If False, the entire publication will be uploaded to the Web server. The default value is True. Read/write.

Syntax

expression .EnableIncrementalUpload

expression A variable that represents an WebOptions object.

Return Value

Boolean

Remarks

The EnableIncrementalUpload property applies only to Web publications that have already been published to a Web server. If a Web publication has not already been published to a Web server, the entire publication will be published to the server during the initial publishing process, regardless of whether the EnableIncrementalUpload property is set to True. If a Web publication has already been published to a Web server and the EnableIncrementalUpload property is then set to True, only changes made to the Web publication, and not the entire publication, after this point will be published to the server.

Example

The following example tests whether the Web publication is set to upload only changes made to the publication. If not, the EnableIncrementalUpload property is set to True to specify that only changes to the publication be uploaded to the Web server.

Copy code Copy code
Dim theWO As WebOptions

Set theWO = Application.WebOptions

With theWO
 If .EnableIncrementalUpload = False Then
 .EnableIncrementalUpload = True
 End If
End With


OLEFormat.Activate Method (Publisher)

 Copy code hover
[image]

OLEFormat.Activate Method (Publisher)
Send feedback

Activates a window or OLE object.

Syntax

expression .Activate

expression A variable that represents an OLEFormat object.

Remarks

Because Microsoft Publisher runs in a single window, using the Activate method with a Window object makes Publisher the active application.

Example

The following example makes Publisher the active application.

VBA Copy code Copy code
Application.ActiveWindow.Activate

The following example adds an Excel spreadsheet to the first page of the active publication and activates the spreadsheet for editing.

VBA Copy code Copy code
Dim shpSheet As Shape

Set shpSheet = ActiveDocument.Pages(1).Shapes.AddOLEObject (Left:=72, Top:=72, ClassName:="Excel.Sheet")

shpSheet.OLEFormat.Activate


PictureFormat.LinkedFileStatus Property (Publisher)

 Copy code hover
[image]

PictureFormat.LinkedFileStatus Property (Publisher)
Send feedback

Returns a PbLinkedFileStatus constant that indicates the status of the file linked to the specified picture. Read-only.

Syntax

expression .LinkedFileStatus

expression A variable that represents a PictureFormat object.

Return Value

PbLinkedFileStatus

Remarks

This property only applies to linked picture files. It returns "Permission Denied" for shapes representing embedded or pasted pictures.

Use either of the following properties to determine whether a shape represents a linked picture:

  • The Type property of the Shape object

  • The IsLinked property of the PictureFormat object

The LinkedFileStatus property value can be one of the PbLinkedFileStatus constants declared in the Microsoft Publisher type library.

Example

The following example generates a list of the linked pictures in the active publication for which the linked files cannot be found.

VBA Copy code Copy code
Dim pgLoop As Page
Dim shpLoop As Shape

For Each pgLoop In ActiveDocument.Pages
 For Each shpLoop In pgLoop.Shapes
 If shpLoop.Type = pbLinkedPicture Then

 With shpLoop.PictureFormat
 If .LinkedFileStatus = pbLinkedFileMissing Then
 Debug.Print .Filename
 End If
 End With

 End If
 Next shpLoop
Next pgLoop


Shapes.AddLine Method (Publisher)

 Copy code hover
[image]

Shapes.AddLine Method (Publisher)
Send feedback

Adds a new Shape object representing a line to the specified Shapes collection.

Syntax

expression .AddLine(BeginX, BeginY, EndX, EndY)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
BeginX | Required | Variant | The x-coordinate of the beginning point of the line.
BeginY | Required | Variant | The y-coordinate of the beginning point of the line.
EndX | Required | Variant | The x-coordinate of the ending point of the line.
EndY | Required | Variant | The y-coordinate of the ending point of the line.

Return Value

Shape

Remarks

For the BeginX, BeginY, EndX, and EndY arguments, numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

Example

The following example adds a new line to the first page of the active publication.

Copy code Copy code
Dim shpLine As Shape

Set shpLine = ActiveDocument.Pages(1).Shapes.AddLine _
 (BeginX:=144, BeginY:=144, _
 EndX:=180, EndY:=72)


ShapeRange.Wizard Property (Publisher)

 Copy code hover
[image]

ShapeRange.Wizard Property (Publisher)
Send feedback

Returns a Wizard object representing the publication design associated with the specified publication or the wizard associated with the specified Design Gallery object.

Syntax

expression .Wizard

expression A variable that represents a ShapeRange object.

Remarks

When accessing the Wizard property from the Document or Page object, if the specified publication is not associated with any publication design, an error occurs. When accessing the Wizard property from the Shape or ShapeRange object, if the specified object is not a Design Gallery object, an error occurs.

Example

The following example reports on the publication design associated with the active publication, displaying its name and current settings.

Copy code Copy code
Dim wizTemp As Wizard
Dim wizproTemp As WizardProperty
Dim wizproAll As WizardProperties

Set wizTemp = ActiveDocument.Wizard

With wizTemp
 Set wizproAll = .Properties
 Debug.Print "Publication design associated with " _
 & "current publication: " _
 & .Name
 For Each wizproTemp In wizproAll
 With wizproTemp
 Debug.Print " Setting: " _
 & .Name & " = " & .CurrentValueId
 End With
 Next wizproTemp
End With
Note Note

Depending on the language version of Publisher that you are using, you may receive an error when using the above code. If this occurs, you will need to build in error handlers to circumvent the errors. For more information, see Wizard object .


TextFrame.TextRange Property (Publisher)

 Copy code hover
[image]

TextFrame.TextRange Property (Publisher)
Send feedback

Returns a TextRange object that represents the text that is attached to a shape, and properties and methods for manipulating the text.

Syntax

expression .TextRange

expression A variable that represents a TextFrame object.

Example

The following example adds text to the text frame of shape one in the active publication, and then formats the new text. This example assumes there is at least one shape on the first page of the active publication.

Copy code Copy code
Sub AddTextToTextFrame()
 With ActiveDocument.Pages(1).TextFrame.TextRange
 .Text = "My Text"
 With .Font
 .Bold = msoTrue
 .Size = 25
 .Name = "Arial"
 End With
 End With
End Sub

The following example adds a rectangle to the active publication and adds text to it.

Copy code Copy code
Sub AddTextToShape()
 With ActiveDocument.Pages(1).Shapes.AddShape(Type:=msoShapeRectangle, _
 Left:=72, Top:=72, Width:=250, Height:=140)
 .TextFrame.TextRange.Text = "Here is some test text"
 End With
End Sub


MailMerge.Application Property (Publisher)

 Copy code hover
[image]

MailMerge.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a MailMerge object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


MailMergeDataFields Object (Publisher)

 Copy code hover
[image]

MailMergeDataFields Object (Publisher)
Send feedback

A collection of MailMergeDataField objects that represent the data fields in a mail merge or catalog merge data source.

Remarks

You cannot add fields to the MailMergeDataFields collection. When a data field is added to a data source, the field is automatically included in the MailMergeDataFields collection.

Example

Use the DataFields property to return the MailMergeDataFields collection.

The following example displays the field names in the data source attached to the active publication.

Copy code Copy code
Sub ShowFieldNames()
 Dim intCount As Integer
 With ActiveDocument.MailMerge.DataSource.DataFields
 For intCount = 1 To .Count
 MsgBox .Item(intCount).Name
 Next
 End With
End Sub

Use DataFields(index), where index is the data field name or the index number, to return a single MailMergeDataField object. The index number represents the position of the data field in the mail merge data source. This example retrieves the name of the first field and value of the first record of the FirstName field in the data source attached to the active publication.

Copy code Copy code
Sub GetDataFromSource()
 With ActiveDocument.MailMerge.DataSource.DataFields
 MsgBox "First field name: " & .Item(1).Name & vbLf & _
 "Value of the first record of the FirstName field: " & _
 .Item("FirstName").Value
 End With
End Sub


WebOptions Properties (Publisher)

 Copy code hover
[image]

WebOptions Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
AlwaysSaveInDefaultEncoding | Returns or sets a Boolean value that specifies whether Web pages within a Web publication should always be saved using default encoding. If True, Web pages within a publication will always be saved using the default encoding of the client computer. If False, Web pages will not be saved using default encoding. The default value is False. Read/write.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
EmailAsImg | True to send the entire publication page as a single JPEG image. Read/write Boolean.
EnableIncrementalUpload | Returns or sets a Boolean value that specifies whether changes made to a Web publication can be uploaded to a Web server independent of the entire publication. If True, only changes made to a publication will be uploaded to the Web server when published. If False, the entire publication will be uploaded to the Web server. The default value is True. Read/write.
Encoding | Returns an MsoEncoding constant that specifies the encoding of the Web publication. Read/write.
OrganizeInFolder | Returns or sets a Boolean value that specifies whether a Web publication will be saved in a flat structure or hierarchical structure. If False, all files in the Web publication will be saved in a flat structure within the root folder. If True, the files will be saved in a hierarchical structure within the root folder. The default value is True. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
RelyOnVML | Returns or sets a Boolean value that specifies whether image files are generated from drawing objects when a Web publication is saved. If True, image files are not generated. If False, images are generated. The default value is False. Read/write.
ShowOnlyWebFonts | Returns or sets a Boolean value that specifies whether only Web-safe fonts and font schemes should be used when the Web site is viewed in a browser. If True, only Web-safe fonts and font schemes are used. If False, display is not limited to Web-safe fonts and font schemes. The default value is False. Read/write.


Font Properties (Publisher)

 Copy code hover
[image]

Font Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
AllCaps | Returns or sets msoTrue if the font is formatted as all capital letters, or returns one of the other MsoTriState constants if it is not. Read/write.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
AttachedToText | True if the Font or ParagraphFormat object is attached to a TextRange object. If the object is attached to a TextRange object, the document will be updated when properties of the object are changed. If the object is not attached, nothing in the document will be changed until the object is applied to a TextRange or Style object. Read-only Boolean.
AutomaticPairKerningThreshold | Returns or sets a Variant value that represents the point size above which kerning is automatically adjusted for characters in the specified text range. Read/write.
Bold | Returns or sets an MsoTriState constant that represents the state of the Bold property on the characters in a text range. Read/write.
BoldBi | Returns or sets an MsoTriState constant indicating whether the font is bold; used with text in a right-to-left language. Read/write.
ContextualAlternates | Returns or sets an MsoTriState constant that represents the state of the ContextualAlternates property on the characters in a text range. The ContextualAlternates property enables different shape choices for some characters depending on the context of the character and the design of the selected font. Read/write.
DiacriticColor | Returns a ColorFormat object representing the 24-bit color used for diacritics in a right-to-left language publication.
ExpandUsingKashida | Returns or sets an MsoTriState constant indicating whether to apply kashida rules while applying tracking to Arabic text. Read/write.
Fill | Returns a FillFormat object that contains fill formatting properties for the font used by the specified range of text. Read-only.
Glow | Returns a GlowFormat object that represents the glow formatting for the font used by the specified range of text. Read-only.
Italic | Returns or sets an MsoTriState constant indicating whether the specified text is formatted as italic. Read/write.
ItalicBi | Returns or sets an MsoTriState constant indicating whether the specified text is formatted as italic; applies to text in a right-to-left language. Read/write.
Kerning | Returns or sets a Variant indicating the amount of horizontal spacing Microsoft Publisher applies to the characters in the text range. Read/write.
Ligature | Returns or sets a pbLigaturePresetType constant that represents the state of the Ligature property on the characters in a text range. The Ligature property enables embellishments to the characters, often in the form of bigger and more flamboyant serifs. Read/write.
Line | Returns a LineFormat object that specifies the formatting for a line. Read/write.
Name | Indicates the name of the specified font. Read/write.
NumberStyle | Returns or sets a pbNumberStyles constant that represents the state of the NumberStyles property on the numerical characters in a text range. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Position | Returns or sets a Variant representing the font position relative to the baseline of the text in the specified range. Positive values move the text above the normal baseline, negative values move the text below the baseline. Indeterminate values are returned as -9999.0. Read/write.
Reflection | Returns a ReflectionFormat object that represents the reflection formatting for a shape. Read-only.
Scaling | Returns or sets a Variant value used to scale the width of the characters in the text range as a percentage of the current font size. Read/write.
Size | Represents the size of the characters in the text range in points. Read/write.
SizeBi | Returns or sets a Variant value representing the size, in points, of the Font object for text in a right-to-left language. Valid range is 0.5 points to 999.5 points. Read/write.
SmallCaps | Returns or sets an MsoTriState constant indicating whether the specified text is formatted as small caps. Read/write.
StrikeThrough | Returns or sets an MsoTriState constant that represents the state of the StrikeThrough property on the characters in a text range. Read/write.
StylisticAlternates | Returns or sets a Variant that represents the state of the StylisticAlternates property on the characters in a text range. The StylisticAlternates property allows you to select an alternate look for the look of the characters you have selected, if the font designer has created these alternates. Read/write.
StylisticSets | Returns or sets a Variant that represents the state of the StylisticSets property on the characters in a text range. Read/write.
SubScript | Returns or sets an MsoTriState constant indicating whether characters are formatted as subscript in the specified text range. Read/write.
SuperScript | Returns or sets an MsoTriState constant indicating whether characters are formatted as superscript in the specified text range. Read/write.
Swash | Returns or sets an MsoTriState constant that represents the state of the Swash property on the characters in a text range. The Swash property enables embellishments to the characters, often in the form of bigger and more flamboyant serifs. Read/write.
TextShadow | Returns a ShadowFormat object that specifies the shadow formatting for the specified font.
ThreeD | Returns a ThreeDFormat object that contains 3-D effect formatting properties for the specified font. Read-only.
Tracking | Returns or sets a Variant indicating the tracking value used to display space between the characters in the specified text range. Read/write.
TrackingPreset | Returns or sets a PbTrackingPresetType constant representing the preset tracking type for characters in the specified font in a text range. Read/write.
Underline | Returns or sets an PbUnderlineType constant that indicates the type of underline for the selected characters in the specified font in a text range. Read/write.
UseDiacriticColor | Returns or sets MsoTriState constant indicating whether you can set the color of diacritics in the specified text range. Read/write.


BuildingBlock Members (Publisher)

 Copy code hover
[image]

BuildingBlock Members (Publisher)
Send feedback

Represents a single building block. The BuildingBlock object is a member of the BuildingBlocks collection.

Methods

Name | Description
Delete | Deletes the specified BuildingBlock object from the BuildingBlocks collection returned by the Document.AvailableBuildingBlocks property for the current document.

Properties

Name | Description
Category | Gets or sets a string that represents the category for the building block. Read/Write.
Description | Gets or sets a string that represents the description of the building block. Read/write.
Gallery | A PbBuildingBlockGallery constant that indicates the building block gallery on the ribbon that contains the specified building block, if ShowInGallery is True. Read/write.
Keywords | A string that represents the search keywords associated with the building block. Read/write.
Name | A string that represents the unique name of the building block. Read/write.
ShowInGallery | A Boolean value that specifies whether the building block should be displayed in the ribbon gallery it belongs to. Read/write.
Type | A PbBuildingBlockType Enumeration (Publisher) value that represents the type of the building block. Read-only.


Attachments.Count Property (Publisher)

 Copy code hover
[image]

Attachments.Count Property (Publisher)
See also Send feedback

Returns the number of Attachment objects in the Attachments collection of an EmailMergeEnvelope object. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .Count

expression A variable that represents an Attachments collection.

Return Value

Long

See also

Concepts

Attachments Collection

Other resources

Attachments Object Members


Options.ShowTipPages Property (Publisher)

 Copy code hover
[image]

Options.ShowTipPages Property (Publisher)
Send feedback

True for Microsoft Publisher to display tippages in balloons. Read/write Boolean.

Syntax

expression .ShowTipPages

expression A variable that represents a Options object.

Return Value

Boolean

Example

This example disables displaying tippages in balloons.

VBA Copy code Copy code
Sub DontShowTipPages()
 Options.ShowTipPages = False
End Sub


Document Object (Publisher)

 Copy code hover
[image]

Document Object (Publisher)
Send feedback

Represents a publication.

Example

Use the ActiveDocument property to refer to the current publication. This example adds a table to the first page of the active publication.

Copy code Copy code
Sub NewTable()
 With ActiveDocument.Pages(1).Shapes
 .AddTable NumRows:=3, NumColumns:=3, Left:=72, Top:=300, _
 Width:=488, Height:=36
 With .Item(1).Table.Rows(1)
 .Cells(1).TextRange.Text = "Column1"
 .Cells(2).TextRange.Text = "Column2"
 .Cells(3).TextRange.Text = "Column3"
 End With
 End With
End Sub

You can also write the above routine by using a reference to the ThisDocument module. This example uses a ThisDocument reference instead of ActiveDocument.

Copy code Copy code
Sub PrintPublication()
 With ThisDocument.Pages(1).Shapes
 .AddTable NumRows:=3, NumColumns:=3, Left:=72, Top:=300, _
 Width:=488, Height:=36
 With .Item(1).Table.Rows(1)
 .Cells(1).TextRange.Text = "Column1"
 .Cells(2).TextRange.Text = "Column2"
 .Cells(3).TextRange.Text = "Column3"
 End With
 End With
End Sub


MailMergeMappedDataFields.Count Property (Publisher)

 Copy code hover
[image]

MailMergeMappedDataFields.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a MailMergeMappedDataFields object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


SoftEdgeFormat Properties (Publisher)

 Copy code hover
[image]

SoftEdgeFormat Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Radius | Returns or sets a Single that represents the length of the radius for a soft edge effect. Read/write.
Type | Returns or sets a Single that represents the length of the radius for a soft edge effect. Read/write.
Visible | True if the specified object, or the formatting applied to it, is visible. Read/write MsoTriState.


LineFormat.BackColor Property (Publisher)

 Copy code hover
[image]

LineFormat.BackColor Property (Publisher)
Send feedback

Returns or sets a ColorFormat object representing the background color for the specified fill or patterned line. .

Syntax

expression .BackColor

expression A variable that represents a LineFormat object.

Remarks

Use the ForeColor property to set the foreground color for a fill or line.

Example

This example adds a rectangle to the active publication and then sets the foreground color, background color, and gradient for the rectangle's fill.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes.AddShape _
 (Type:=msoShapeRectangle, _
 Left:=90, Top:=90, Width:=90, Height:=50).Fill
 .ForeColor.RGB = RGB(128, 0, 0)
 .BackColor.RGB = RGB(170, 170, 170)
 .TwoColorGradient _
 Style:=msoGradientHorizontal, Variant:=1
End With

This example adds a patterned line to the active publication.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes.AddLine _
 (BeginX:=10, BeginY:=100, EndX:=250, EndY:=0).Line
 .Weight = 6
 .ForeColor.RGB = RGB(0, 0, 255)
 .BackColor.RGB = RGB(128, 0, 0)
 .Pattern = msoPatternDarkDownwardDiagonal
End With


ColorScheme Members (Publisher)

 Copy code hover
[image]

ColorScheme Members (Publisher)
Send feedback

Represents a color scheme, which is a set of eight colors used for the different elements of a publication. Each color is represented by a ColorFormat object. The ColorScheme object is a member of the ColorSchemes collection. The ColorSchemes collection contains all the color schemes available to Microsoft Publisher.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Colors | Returns a ColorFormat object representing a color from the specified color scheme.
Name | Returns a String value indicating the name of the specified object. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Tags.Count Property (Publisher)

 Copy code hover
[image]

Tags.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a Tags object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


Shape.ZOrderPosition Property (Publisher)

 Copy code hover
[image]

Shape.ZOrderPosition Property (Publisher)
Send feedback

Returns a Long indicating the position of the specified shape or shape range in the z-order. Read-only.

Syntax

expression .ZOrderPosition

expression A variable that represents a Shape object.

Remarks

A shape's position in the z-order corresponds to the shape's index number in the Shapes collection. For example, if there are four shapes on the page, the expression ActiveDocument.Pages(1).Shapes(1) returns the shape at the back of the z-order, and the expression ActiveDocument.Pages(1).Shapes(4) returns the shape at the front of the z-order.

Whenever you add a new shape to a collection, it is added to the front of the z-order by default.

To set the shape's position in the z-order, use the ZOrder method.

Example

This example adds an oval to the active publication, and then places the oval second from the back in the z-order if there is at least one other shape on the page.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes _
 .AddShape(Type:=msoShapeOval, _
 Left:=100, Top:=100, Width:=100, Height:=300)
 Do While .ZOrderPosition > 2
 .ZOrder msoSendBackward
 Loop
End With


Printer Object (Publisher)

 Copy code hover
[image]

Printer Object (Publisher)
Send feedback

A Printer object represents a printer installed on your computer.

Version Information

Version Added: Publisher 2007

Remarks

Many of the properties, such as PaperSize, PaperSource, and PaperOrientation, of the Printer object correspond to the settings in the Print Setup dialog box (File menu) in the Microsoft Publisher user interface .

The collection of all the printers installed on your computer is represented by the InstalledPrinters collection.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how you can use the PrinterName and IsActivePrinter properties of the Printer object to get a list of all the installed printers on the computer, determine which of them is currently the active printer, and get some of the settings of the active printer. The macro displays the results in the Immediate window.

VBA Copy code Copy code
Public Sub Printer_Example()

 Dim pubInstalledPrinters As Publisher.InstalledPrinters
 Dim pubApplication As Publisher.Application
 Dim pubPrinter As Publisher.Printer

 Set pubApplication = ThisDocument.Application
 Set pubInstalledPrinters = pubApplication.InstalledPrinters

 For Each pubPrinter In pubInstalledPrinters
 Debug.Print pubPrinter.PrinterName
 If pubPrinter.IsActivePrinter Then
 Debug.Print "This is the active printer"
 Debug.Print "Paper size is ", pubPrinter.PaperSize
 Debug.Print "Paper orientation is ", pubPrinter.PaperOrientation
 Debug.Print "Paper source is ", pubPrinter.PaperSource
 End If
 Next

End Sub


Column Members (Publisher)

 Copy code hover
[image]

Column Members (Publisher)
Send feedback

Represents a single table column. The Column object is a member of the Columns collection. The Columns collection includes all the columns in a table, selection, or range.

Methods

Name | Description
Delete | Deletes the specified object.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Cells | Returns a CellRange object that represents the cell or cells in a column of a table.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Width | Returns or sets a Variant that represents the width (in points) of a specified table column or shape. Read/write.


Printer.PrintMode Property (Publisher)

 Copy code hover
[image]

Printer.PrintMode Property (Publisher)
Send feedback

Read/write

Version Information

Version Added: Publisher 2010

Syntax

expression .PrintMode

expression An expression that returns a Printer object.

Return Value

PbPrintMode


PhoneticGuide.FontSize Property (Publisher)

 Copy code hover
[image]

PhoneticGuide.FontSize Property (Publisher)
Send feedback

Returns a Variant that represents the font size of phonetic characters. Read-only.

Syntax

expression .FontSize

expression A variable that represents a PhoneticGuide object.


PbPrintGraphics Enumeration (Publisher)

 Copy code hover
[image]

PbPrintGraphics Enumeration (Publisher)
Send feedback

Represents the resolution at which the inserted graphics are to be printed in the specified publication.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbPrintHighResolution | 1 | Default. Print linked graphics using the full-resolution linked version.
pbPrintLowResolution | 2 | Print linked graphics using the low-resolution placeholder version that is stored in the publication.
pbPrintNoGraphics | 3 | Print a box in place of linked graphics.


ShapeRange.WizardTag Property (Publisher)

 Copy code hover
[image]

ShapeRange.WizardTag Property (Publisher)
Send feedback

Returns or sets a PbWizardTag constant indicating the function of a specified shape with respect to its publication design. Read/write.

Syntax

expression .WizardTag

expression A variable that represents a ShapeRange object.

Remarks

The WizardTag property value can be one of the PbWizardTag constants declared in the Microsoft Publisher type library.

The combination of the WizardTagInstance property and the WizardTag property uniquely defines every shape in a publication.

Example

The following example displays the wizard tag and wizard tag instance information for all the shapes on page one of the active publication.

Copy code Copy code
Dim shpLoop As Shape

For Each shpLoop In ActiveDocument.Pages(1).Shapes
 With shpLoop
 Debug.Print "Shape: " & .Name
 Debug.Print " Wizard tag: " & .WizardTag
 Debug.Print " Wizard tag instance: " _
 & .WizardTagInstance
 End With
Next shpLoop


Shape Properties (Publisher)

 Copy code hover
[image]

Shape Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Adjustments | Returns an Adjustments collection representing all adjustment handles for the specified Shape or ShapeRange object.
AlternativeText | Returns or sets a String representing the text displayed by a Web browser in place of the Shape object while the Shape object is being downloaded or when graphics are turned off. Read/write.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
AutoShapeType | Returns or sets an MsoAutoShapeType constant that specifies a Shape object's AutoShape type.
BlackWhiteMode | Returns or sets an MsoBlackWhiteMode constant indicating how the specified shape or shape range appears when the publication is viewed in black-and-white mode. Read/write.
BorderArt | Returns a BorderArtFormat object that represents the BorderArt type applied to the specified shape. Returns "Permission Denied" if BorderArt has not been applied to the shape. Read-only.
Callout | Returns a CalloutFormat object representing the formatting of a line callout.
CatalogMergeItems | Returns a CatalogMergeShapes collection that represents the shapes included in the catalog merge area. Read-only.
ConnectionSiteCount | Returns a Long indicating the count of connection sites on the current Shape object. Read-only.
Connector | Returns an MsoTriState value indicating whether the specified shape is a connector. Read-only.
ConnectorFormat | Returns a ConnectorFormat object that contains connector formatting properties. Applies to Shape or ShapeRange objects that represent connectors. Read-only.
Fill | Returns a FillFormat object representing the fill for the specified shape or table cell.
Glow | Returns a GlowFormat object that represents the glow formatting for a shape. Read-only.
GroupItems | Returns a GroupShapes collection if the specified shape is a group.
HasTable | Returns msoTrue if the shape represents a TableFrame object or msoFalse if the shape represents any other object type. Read-only.
HasTextFrame | Returns an MsoTriState constant if the specified shape has a TextFrame object associated with it. Read-only.
Height | Returns or sets a Variant that represents the height (in points) of a specified table row or shape. Read/write.
HorizontalFlip | Indicates whether the specified shape has been flipped around its horizontal axis. Read-only.
Hyperlink | Returns a Hyperlink object representing the hyperlink associated with the specified shape.
ID | Returns a Long that represents the type of a shape, range of shapes, or property, type, or value of a wizard. Read-only.
InlineAlignment | Returns or sets a PbInlineAlignment constant that indicates whether an inline shape has left, right, or in-text alignment. Read/write.
InlineTextRange | Returns a TextRange object that reflects the position of the inline shape in its containing text range. Read-only.
IsExcess | Indicates whether the parent Shape object is an excess shape after the document template (wizard) is changed by using the Document.ChangeDocument method or by using the Change Template command in the user interface. Microsoft Publisher places any excess shape under Extra Content in the Format Publication task pane. Read-only.
IsGroupMember | Returns True if the specified shape is a member of a group, False otherwise. Read-only Boolean.
IsInline | Returns an MsoTriState constant that specifies whether a shape is inline (contained in a text run). Read-only.
Left | Returns or sets a Variant indicating the distance from the left edge of the page to the leftmost edge of the specified shape. Numeric values are in points; all other values are in any measurement supported by Publisher (for example, "2.5 in"). Read/write.
Line | Returns a LineFormat object that contains line formatting properties for the specified shape. (For a line, the LineFormat object represents the line itself; for a shape with a border, the LineFormat object represents the border.).
LinkFormat | Returns a LinkFormat object that contains the properties that are unique to linked OLE objects. Read-only.
LockAspectRatio | Returns or sets an MsoTriState constant indicating whether the specified shape retains its original proportions when you resize it. Read/write.
Name | Returns or sets a String value indicating the name of the specified object. Read/write.
Nodes | Returns a ShapeNodes collection that represents the geometric description of the specified shape. Applies to Shape or ShapeRange objects that represent freeform drawings.
OLEFormat | Returns an OLEFormat object that contains OLE formatting properties for the specified shape. Applies to Shape or ShapeRange objects that represent OLE objects.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
ParentGroupShape | Returns a Shape object that represents the common parent shape of a child shape or a range of child shapes.
PictureFormat | Returns a PictureFormat object that contains picture formatting properties for the specified object. Applies to Shape or ShapeRange objects that represent pictures or OLE objects. Read-only.
Reflection | Returns a ReflectionFormat object that represents the reflection formatting for a shape. Read-only.
Rotation | Returns or sets a Single that represents the number of degrees the specified shape is rotated around the z-axis. A positive value indicates clockwise rotation; a negative value indicates counterclockwise rotation. Read/write.
Shadow | Returns a ShadowFormat object that represents the shadow formatting for the specified shape.
SoftEdge | Returns a SoftEdgeFormat object that represents the soft edge formatting for a shape. Read-only.
Table | Returns a Table object that represents a table in Microsoft Publisher.
Tags | Returns a Tags collection representing tags or custom properties applied to a shape, shape range, page, or publication.
TextEffect | Returns a TextEffectFormat object that represents the text formatting properties of a WordArt object.
TextFrame | Returns a TextFrame object that represents the text in a shape and the properties that control the margins and orientation of the text.
TextWrap | Returns a WrapFormat object that represents the properties for wrapping text around a shape or shape range.
ThreeD | Returns a ThreeDFormat object.
Top | Returns or sets a Variant that represents the distance between the top of the page and the top of a shape. Read/write.
Type | Specifies the shape type. Read-only.
VerticalFlip | Returns msoTrue if the specified shape has been flipped around its vertical axis. Read-only.
Vertices | Returns the coordinates of the specified freeform drawing's vertices (and control points for Bézier curves) as a series of coordinate pairs. Read-only Variant.
WebCheckBox | Returns the WebCheckBox object associated with the specified shape.
WebCommandButton | Returns the WebCommandButton object associated with the specified shape.
WebListBox | Returns the WebListBox object associated with the specified shape.
WebNavigationBarSetName | Returns a String that represents the name of the Web navigation bar set the specified shape is an instance of. Read-only.
WebOptionButton | Returns the WebOptionButton object associated with the specified shape.
WebTextBox | Returns the WebTextBox object associated with the specified shape.
Width | Returns or sets a Variant that represents the width (in points) of a specified table column or shape. Read/write.
Wizard | Returns a Wizard object representing the publication design associated with the specified publication or the wizard associated with the specified Design Gallery object.
WizardTag | Returns or sets a PbWizardTag constant indicating the function of a specified shape with respect to its publication design. Read/write.
WizardTagInstance | Returns or sets a Long indicating the instance of the specified shape compared with other shapes having the same wizard tag. Read/write.
ZOrderPosition | Returns a Long indicating the position of the specified shape or shape range in the z-order. Read-only.


GlowFormat.Radius Property (Publisher)

 Copy code hover
[image]

GlowFormat.Radius Property (Publisher)
See also Send feedback

Returns or sets a Single that represents the length of the radius for a glow effect. Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .Radius

expression A variable that represents a GlowFormat object.

Return value

Single

See also

Other resources

GlowFormat Object
GlowFormat Object Members


BuildingBlocks.Count Property (Publisher)

 Copy code hover
[image]

BuildingBlocks.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a BuildingBlocks object.


WizardValue.Name Property (Publisher)

 Copy code hover
[image]

WizardValue.Name Property (Publisher)
Send feedback

Returns a String value indicating the name of the specified object. Read-only.

Syntax

expression .Name

expression A variable that represents a WizardValue object.

Remarks

You can use an object's name in conjunction with the Item method or Item property to return a reference to the object if the Item method or property for the collection that contains the object takes a Variant argument. For example, if the value of the Name property for a shape is Rectangle 2, then .Shapes("Rectangle 2") will return a reference to that shape.

The Name property is the default property for the BorderArt, BorderArtFormat, and Label objects.


BorderArt Members (Publisher)

 Copy code hover
[image]

BorderArt Members (Publisher)
Send feedback

Represents an available type of BorderArt. BorderArt is picture borders that can be applied to text boxes, picture frames, or rectangles. The BorderArt object is a member of the BorderArts collection. The BorderArts collection contains all BorderArt available for use in the specified publication.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Name | Returns a String value indicating the name of the specified object. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Hyperlink Members (Publisher)

 Copy code hover
[image]

Hyperlink Members (Publisher)
Send feedback

Represents a hyperlink. The Hyperlink object is a member of the Hyperlinks collection and the Shape and ShapeRange objects.

Methods

Name | Description
Delete | Deletes the specified object.
SetPageRelative | Sets the target type for the specified hyperlink.

Properties

Name | Description
Address | Returns or sets a String that represents the URL address for a hyperlink. Read/write.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
EmailSubject | Sets or returns a String that represents the subject for e-mail messages generated to process Web form data. Read/write.
PageID | Returns or sets a Long indicating the page in the publication that is the destination for the specified hyperlink. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Range | Returns a TextRange object representing the base text to which the specified hyperlink has been applied.
Shape | Returns a Shape object that represents the shape associated with a hyperlink.
TargetType | Returns a PbHlinkTargetType constant that represents the type of hyperlink. Read-only.
TextToDisplay | Returns or sets a String that represents the text displayed for a hyperlink. Read/write.
Type | Returns an MsoHyperlinkType constant that represents the hyperlink type. Read-only.


Shapes Object (Publisher)

 Copy code hover
[image]

Shapes Object (Publisher)
Send feedback

A collection of Shape objects that represent all the shapes on a page of a publication. Each Shape object represents an object in the drawing layer, such as an AutoShape, freeform, OLE object, or picture.

Note Note

If you want to work with a subset of the shapes on a document — for example, to do something to only the AutoShapes on the document or to only the selected shapes — you must construct a ShapeRange collection that contains the shapes with which you want to work.

Example

Use the Shapes property to return the Shapes collection. The following example selects all the shapes on the first page of the active publication.

Copy code Copy code
Sub SelectAllShapes()
    ActiveDocument.Pages(1).Shapes.SelectAll
End Sub
Note Note

If you want to do something (like delete or set a property) to all the shapes in a publication at the same time, use the Range method to create a ShapeRange object that contains all the shapes in the Shapes collection, and then apply the appropriate property or method to the ShapeRange object.

Use one of the following methods of the Shapes collection: AddCallout , AddConnector , AddCurve , AddLabel , AddLine , AddOLEObject , AddPolyline , AddShape , AddTextbox , or AddTextEffect to add a shape to a publication and return a Shape object that represents the newly created shape. The following example adds a new shape to the active publication.

Copy code Copy code
Sub AddNewShape()
    ActiveDocument.Pages(1).Shapes.AddShape Type:=msoShapeFoldedCorner, _
        Left:=50, Top:=50, Width:=100, Height:=200
End Sub

Use Shapes(index), where index is the index number, to return a single Shape object. The following example horizontally flips shape one on the first page of the active publication.

Copy code Copy code
Sub FlipShape()
    ActiveDocument.Pages(1).Shapes(1).Flip FlipCmd:=msoFlipHorizontal
End Sub


ShadowFormat Members (Publisher)

 Copy code hover
[image]

ShadowFormat Members (Publisher)
Send feedback

Represents shadow formatting for a shape.

Methods

Name | Description
IncrementOffsetX | Incrementally changes the horizontal offset of the shadow by the specified distance.
IncrementOffsetY | Incrementally changes the vertical offset of the shadow by the specified distance.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Blur | Returns or sets a Single that represents the blur level for a shadow format. Read/write.
ForeColor | Returns or sets a ColorFormat object representing the foreground color for the fill, line, or shadow. Read/write.
Obscured | Returns or sets an MsoTriState value indicating whether the shadow of the specified shape appears filled in and is obscured by the shape. Read/write.
OffsetX | Returns or sets a Variant value indicating the vertical offset of the shadow from the specified shape. A positive value offsets the shadow below the shape; a negative value offsets it above the shape. Read/write.
OffsetY | Returns or sets a Variant value indicating the horizontal offset of the shadow from the specified shape. A positive value offsets the shadow to the right of the shape; a negative value offsets it to the left. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
RotateWithShape | Returns or sets an MsoTriState constant that represents whether to rotate the shadow when rotating the shape. Read/write.
Size | Returns or sets a Single that represents the width of the shadow. Read/write.
Type | Specifies the shadow type of a shape. Read/write.
Visible | Returns or sets an MsoTriState constant indicating whether the specified object or the formatting applied to the specified object is visible. Read/write.


ParagraphFormat.SpaceAfter Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.SpaceAfter Property (Publisher)
Send feedback

Returns or sets a Variant that represents the amount of spacing (in points) after one or more paragraphs. Read/write.

Syntax

expression .SpaceAfter

expression A variable that represents a ParagraphFormat object.

Return Value

Variant

Example

This example sets the spacing before and after the third paragraph in the first shape on the first page of the active publication to 6 points.

VBA Copy code Copy code
Sub SetSpacingBeforeAfterParagraph()
 With ActiveDocument.Pages(1).Shapes(1).TextFrame _
 .TextRange.Paragraphs(3).ParagraphFormat
 .SpaceBefore = 6
 .SpaceAfter = 6
 End With
End Sub

This example sets spacing before and after all paragraphs in the first shape on the first page of the active publication to 6 points.

VBA Copy code Copy code
Sub SetSpacingBeforeAfterAllParagraph()
 With ActiveDocument.Pages(1).Shapes(1).TextFrame _
 .TextRange.ParagraphFormat
 .SpaceBefore = 12
 .SpaceAfter = 6
 End With
End Sub


Page.IgnoreMaster Property (Publisher)

 Copy code hover
[image]

Page.IgnoreMaster Property (Publisher)
Send feedback

True for Microsoft Publisher to ignore the master page formatting for the specified page. Read/write Boolean.

Syntax

expression .IgnoreMaster

expression A variable that represents an Page object.

Return Value

Boolean

Example

This example adds a red star in the upper left corner of the master page so that it shows up on each page; then it adds a couple of new pages and sets one of the pages to ignore the master page so that the shape doesn't show on it.

Copy code Copy code
Sub AddNewPageIgnoreMaster()
 Dim pgNew As Page

 With ActiveDocument
 .MasterPages(1).Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=50, Top:=50, Width:=50, Height:=50).Fill.ForeColor _
 .CMYK.SetCMYK Cyan:=0, Magenta:=255, Yellow:=255, Black:=0
 .Pages.Add Count:=1, After:=1
 Set pgNew = .Pages.Add(Count:=1, After:=1)
 pgNew.IgnoreMaster = True
 End With
End Sub


TextRange.Script Property (Publisher)

 Copy code hover
[image]

TextRange.Script Property (Publisher)
Send feedback

Returns a PbFontScriptType constant that represents the font script for a text range. Read-only.

Syntax

expression .Script

expression A variable that represents a TextRange object.

Return Value

PbFontScriptType

Remarks

The Script property value can be one of the PbFontScriptType constants declared in the Microsoft Publisher type library.

Example

This example displays a message if the font script used in the specified text range is ASCII Latin. This example assumes that there is at least one shape on the first page of the active publication.

VBA Copy code Copy code
Sub DisplayScriptType()
 If ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange _
 .Script = pbFontScriptAsciiLatin Then
 MsgBox "The font script you are using is ASCII Latin."
 End If
End Sub


TextStyle.Name Property (Publisher)

 Copy code hover
[image]

TextStyle.Name Property (Publisher)
Send feedback

Returns a String value indicating the name of the specified object. Read-only.

Syntax

expression .Name

expression A variable that represents a TextStyle object.

Remarks

You can use an object's name in conjunction with the Item method or Item property to return a reference to the object if the Item method or property for the collection that contains the object takes a Variant argument. For example, if the value of the Name property for a shape is Rectangle 2, then .Shapes("Rectangle 2") will return a reference to that shape.

The Name property is the default property for the BorderArt, BorderArtFormat, and Label objects.


MasterPages.Parent Property (Publisher)

 Copy code hover
[image]

MasterPages.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a MasterPages object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


LineFormat.CapStyle Property (Publisher)

 Copy code hover
[image]

LineFormat.CapStyle Property (Publisher)
See also Send feedback

Specifies the style of line endings, as well as the format of dashed lines. Read-write.

Version Information

Version Added: Publisher 2013

Syntax

expression .CapStyle

expression A variable that represents a LineFormat object.

Return value

MSOLINECAPSTYLE

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


Application.LinesToPoints Method (Publisher)

 Copy code hover
[image]

Application.LinesToPoints Method (Publisher)
See also Send feedback

Converts a measurement from lines to points (1 line = 12 points). Returns the converted measurement as a Single.

Syntax

expression .LinesToPoints(Value)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Value | Required | Single | The line value to be converted to points.

Return Value

Single

Remarks

This method assumes a measurement in 12-point lines — the actual size of any text in the publication has no effect on the conversion factor.

Use the PointsToLines method to convert measurements in points to lines.

Example

This example converts measurements in lines to measurements in points, demonstrating that the font size in the current selection has no bearing on the conversion factor. Some text must be selected in the active publication for this example to work.

Copy code Copy code
Dim strOutput As String

' Set text size to 10 points.
Selection.TextRange.Font.Size = 10

' Display result for one line of text.
strOutput = "1 line = " _
 & Format(Application _
 .LinesToPoints(Value:=1), _
 "0.00") & " points"

See also

Concepts

Application Object

Other resources

Application Object Members


PrintableRect.Height Property (Publisher)

 Copy code hover
[image]

PrintableRect.Height Property (Publisher)
Send feedback

Returns a Single that represents the height, in points, of the printable rectangle. Read-only.

Syntax

expression .Height

expression A variable that represents a PrintableRect object.

Remarks

The valid range for the Height property depends on the size of the application workspace and the position of the object within the workspace. For centered objects on non-banner page sizes, the Height property may be 0.0 to 50.0 inches. For centered objects on banner page sizes, the Height property may be 0.0 to 241.0 inches.


WebNavigationBarHyperlinks.Count Property (Publisher)

 Copy code hover
[image]

WebNavigationBarHyperlinks.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a WebNavigationBarHyperlinks object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


Options.DragAndDropText Property (Publisher)

 Copy code hover
[image]

Options.DragAndDropText Property (Publisher)
Send feedback

True to enable dragging of text. Read/write Boolean.

Syntax

expression .DragAndDropText

expression A variable that represents a Options object.

Return Value

Boolean

Example

This example sets global options for Microsoft Publisher, including enabling dragging to reposition text.

Copy code Copy code
Sub SetGlobalOptions()
 With Options
 .AutoFormatWord = True
 .AutoKeyboardSwitching = True
 .AutoSelectWord = True
 .DragAndDropText = True
 .UseCatalogAtStartup = False
 .UseHelpfulMousePointers = False
 End With
End Sub


PbTabLeaderType Enumeration (Publisher)

 Copy code hover
[image]

PbTabLeaderType Enumeration (Publisher)
Send feedback

Represents the leader character for a tab stop.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbTabLeaderBullet | 5 | Leader bullet tab
pbTabLeaderDashes | 2 | Leader dashes tab
pbTabLeaderDot | 1 | Leader dot tab
pbTabLeaderLine | 3 | Tab leader line
pbTabLeaderNone | 0 | Tab leader none


Font.Line Property (Publisher)

 Copy code hover
[image]

Font.Line Property (Publisher)
See also Send feedback

Returns a LineFormat object that specifies the formatting for a line. Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .Line

expression A variable that represents a Font object.

Return value

LINEFORMAT

See also

Concepts

Font Object

Other resources

Font Object Members


Application.IsValidObject Method (Publisher)

 Copy code hover
[image]

Application.IsValidObject Method (Publisher)
See also Send feedback

Determines whether the specified object variable references a valid object and returns a Boolean value: True if the specified variable that references an object is valid, False if the object referenced by the variable has been deleted.

Syntax

expression .IsValidObject(Object)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Object | Required | Object | A variable that references an object.

Return Value

Boolean

Example

This example formats the line of a valid object.

Copy code Copy code
Sub ValidShape(shpObject As Shape)

 If Application.IsValidObject object:=shpObject) = True Then
 With shpObject.Line
 .DashStyle = msoLineRoundDot
 .ForeColor.RGB = RGB(Red:=158, Green:=50, Blue:=208)
 .Weight = 5
 End With
 End If

End Sub

Use the following subroutine to call the above subroutine.

Copy code Copy code
Sub CallValidShape()
 Call ValidShape(shpObject:=ActiveDocument.Pages(1).Shapes(2))
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


MailMergeDataSource.RecordCount Property (Publisher)

 Copy code hover
[image]

MailMergeDataSource.RecordCount Property (Publisher)
Send feedback

Returns a Long that represents the number of records in the data source. Read-only.

Syntax

expression .RecordCount

expression A variable that represents a MailMergeDataSource object.

Return Value

Long

Example

This example validates ZIP Codes in the attached data source for five digits. If the length of the ZIP Code is fewer than five digits, the record is excluded from the mail merge process. This example assumes the postal codes are U.S. ZIP Codes. You could modify this example to search for ZIP Codes that have a 4-digit locator code appended to the ZIP Code, and then exclude all records that do not contain the locator code.

VBA Copy code Copy code
Sub Validate

 Dim intCount As Integer
 With ActiveDocument.MailMerge.DataSource

 'Set the active record equal to the first included record in the
 'data source
 .ActiveRecord = 1
 Do
 intCount = intCount + 1

 'Set the condition that field six must be greater than or
 'equal to five digits in length
 If Len(.DataFields.Item(6).Value) < 5 Then

 'Exclude the record if field six contains fewer than five digits
 .Included = False

 'Mark the record as containing an invalid address field
 .InvalidAddress = True

 'Specify the comment attached to the record explaining
 'why the record was excluded from the mail merge
 .InvalidComments = "The ZIP Code for this record has " _
 & "fewer than five digits. It will be removed " _
 & "from the mail merge process."

 End If

 'Move the record to the next record in the data source
 .ActiveRecord = .ActiveRecord + 1

 'End the loop when the counter variable
 'equals the number of records in the data source
 Loop Until intCount = .RecordCount
 End With


TextStyles.Add Method (Publisher)

 Copy code hover
[image]

TextStyles.Add Method (Publisher)
Send feedback

Adds a new TextStyle object to the specified TextStyles object and returns the new TextStyle object.

Syntax

expression .Add(Font, ParagraphFormat, StyleName, BasedOn)

expression A variable that represents a TextStyles object.

Parameters

Name | Required/Optional | Data Type | Description
StyleName | Required | String | The name of the new text style. If the name matches an existing text style, the existing text style is overwritten.
BasedOn | Optional | String | The name of the text style on which the new text style is based. If the name does not match an existing text style, an error occurs.
Font | Optional | Font | The font settings to apply to the new text style.
ParagraphFormat | Optional | ParagraphFormat | The paragraph formatting to apply to the new text style.

Return Value

TextStyle

Example

The following example adds a new text style to the active publication based on the Normal text style.

VBA Copy code Copy code
Dim tsNew As TextStyle

Set tsNew = ActiveDocument.TextStyles _
 .Add(StyleName:="Title", BasedOn:="Normal")


CaptionStyles.Application Property (Publisher)

 Copy code hover
[image]

CaptionStyles.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Microsoft Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Syntax

expression .Application

expression A variable that represents a CaptionStyles object.


Application.PointsToInches Method (Publisher)

 Copy code hover
[image]

Application.PointsToInches Method (Publisher)
See also Send feedback

Converts a measurement from points to inches (1 in = 72 points). Returns the converted measurement as a Single.

Syntax

expression .PointsToInches(Value)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Value | Required | Single | The point value to be converted to inches.

Return Value

Single

Remarks

Use the InchesToPoints method to convert measurements in inches to points.

Example

This example converts measurements in points entered by the user to measurements in inches.

Copy code Copy code
Dim strInput As String
Dim strOutput As String

Do While True
 ' Get input from user.
 strInput = InputBox( _
 Prompt:="Enter measurement in points (0 to cancel): ", _
 Default:="0")

 ' Exit the loop if user enters zero.
 If Val(strInput) = 0 Then Exit Do

 ' Evaluate and display result.
 strOutput = Trim(strInput) & " points = " _
 & Format(Application _
 .PointsToInches(Value:=Val(strInput)), _
 "0.00") & " in"

 MsgBox strOutput
Loop

See also

Concepts

Application Object

Other resources

Application Object Members


CellBorder.Color Property (Publisher)

 Copy code hover
[image]

CellBorder.Color Property (Publisher)
Send feedback

Returns a ColorFormat object representing the color information for the specified object.

Syntax

expression .Color

expression A variable that represents a CellBorder object.

Example

This example tests the font color of the first story in the active document and tells the user if the font color is black or not.

Copy code Copy code
Sub FontColor()

 If Application.ActiveDocument.Stories(1) _
 .TextRange.Font.Color.RGB = RGB(Red:=0, Green:=0, Blue:=0) Then
 MsgBox "Your font color is black"
 Else
 MsgBox "Your font color is not black"
 End If

End Sub


TabStop.Alignment Property (Publisher)

 Copy code hover
[image]

TabStop.Alignment Property (Publisher)
Send feedback

Returns or sets a PbTabAlignmentType constant that represents the alignment for the specified tab stop. Read/write.

Syntax

expression .Alignment

expression A variable that represents a TabStop object.

Remarks

The Alignment property value can be one of the PbTabAlignmentType constants declared in the Microsoft Publisher type library.

Example

This example enters a tabbed list and sets the alignment for two custom tab stops. This example assumes that the specified shape is a text frame and not another type of shape and that there are at least two custom tab stops already set.

VBA Copy code Copy code
Sub CustomDecimalTabStop()

 With ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange
 .InsertAfter Newtext:="Pencils" & vbTab & _
 "Each" & vbTab & "1.50" & vbLf
 .InsertAfter Newtext:="Pens" & vbTab & _
 "Each" & vbTab & "4.95" & vbLf
 .InsertAfter Newtext:="Folders" & vbTab & _
 "Box" & vbTab & "35.28" & vbLf
 .InsertAfter Newtext:="Envelopes" & vbTab & _
 "Case" & vbTab & "150.69" & vbLf
 With .Paragraphs(Start:=1).ParagraphFormat
 .Tabs(1).Alignment = pbTabAlignmentCenter
 .Tabs(2).Alignment = pbTabAlignmentDecimal
 End With
 End With
End Sub


Selection Properties (Publisher)

 Copy code hover
[image]

Selection Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
ChildShapeRange | Returns a ShapeRange object representing the child shapes of a selection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
ShapeRange | Returns a ShapeRange collection that represents all the Shape objects in the specified range or selection. The shape range can contain drawings, shapes, pictures, OLE objects, ActiveX controls, text objects, and callouts.
TableCellRange | Returns a CellRange object that represents the cells in a table selection.
TextRange | Returns a TextRange object that represents the text that is attached to a shape and properties and methods for manipulating the text.
Type | Returns a PbSelectionType constant that represents the selection type. Read-only.


TextFrame.BreakForwardLink Method (Publisher)

 Copy code hover
[image]

TextFrame.BreakForwardLink Method (Publisher)
Send feedback

Breaks the forward link for the specified text frame, if such a link exists.

Syntax

expression .BreakForwardLink

expression A variable that represents a TextFrame object.

Remarks

Applying this method to a shape in the middle of a chain of shapes with linked text frames will break the chain, leaving two sets of linked shapes. All of the text, however, will remain in the first series of linked shapes.

Example

This example creates a new publication, adds a chain of three linked text boxes to it, and then breaks the link after the second text box.

Copy code Copy code
Sub BreakTextLink()
 Dim shpTextbox1 As Shape
 Dim shpTextbox2 As Shape
 Dim shpTextbox3 As Shape

 Set shpTextbox1 = ActiveDocument.Pages(1).Shapes.AddTextbox _
 (Orientation:=msoTextOrientationHorizontal, _
 Left:=72, Top:=36, Width:=72, Height:=36)
 shpTextbox1.TextFrame.TextRange = "This is some text. " _
 & "This is some more text. This is even more text. " _
 & "And this is some more text and even more text."

 Set shpTextbox2 = ActiveDocument.Pages(1).Shapes.AddTextbox _
 (Orientation:=msoTextOrientationHorizontal, _
 Left:=72, Top:=108, Width:=72, Height:=36)

 Set shpTextbox3 = ActiveDocument.Pages(1).Shapes.AddTextbox _
 (Orientation:=msoTextOrientationHorizontal, _
 Left:=72, Top:=180, Width:=72, Height:=36)

 shpTextbox1.TextFrame.NextLinkedTextFrame = shpTextbox2.TextFrame
 shpTextbox2.TextFrame.NextLinkedTextFrame = shpTextbox3.TextFrame
 MsgBox "Textboxes 1, 2, and 3 are linked."
 shpTextbox2.TextFrame.BreakForwardLink
End Sub


FillFormat.BackColor Property (Publisher)

 Copy code hover
[image]

FillFormat.BackColor Property (Publisher)
Send feedback

Returns or sets a ColorFormat object representing the background color for the specified fill or patterned line. .

Syntax

expression .BackColor

expression A variable that represents a FillFormat object.

Remarks

Use the ForeColor property to set the foreground color for a fill or line.

Example

This example adds a rectangle to the active publication and then sets the foreground color, background color, and gradient for the rectangle's fill.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes.AddShape _
 (Type:=msoShapeRectangle, _
 Left:=90, Top:=90, Width:=90, Height:=50).Fill
 .ForeColor.RGB = RGB(128, 0, 0)
 .BackColor.RGB = RGB(170, 170, 170)
 .TwoColorGradient _
 Style:=msoGradientHorizontal, Variant:=1
End With

This example adds a patterned line to the active publication.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes.AddLine _
 (BeginX:=10, BeginY:=100, EndX:=250, EndY:=0).Line
 .Weight = 6
 .ForeColor.RGB = RGB(0, 0, 255)
 .BackColor.RGB = RGB(128, 0, 0)
 .Pattern = msoPatternDarkDownwardDiagonal
End With


Documents.Item Property (Publisher)

 Copy code hover
[image]

Documents.Item Property (Publisher)
Send feedback

Returns an individual object from a specified collection. Read-only.

Syntax

expression .Item(Index)

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
varDocument | Required | Variant | Long. The number of the object to return.


ConnectorFormat.EndConnectionSite Property (Publisher)

 Copy code hover
[image]

ConnectorFormat.EndConnectionSite Property (Publisher)
Send feedback

Returns a Long indicating the connection site to which the end of a connector is connected. Read-only.

Syntax

expression .EndConnectionSite

expression A variable that represents an ConnectorFormat object.

Return Value

Long

Remarks

If the end of the specified connector isn't attached to a shape, this property generates an error.

Use the BeginConnectionSite property to return the site to which the beginning of a connector is connected.

Example

This example assumes that the first page in the active publication already contains two shapes attached by a connector named Conn1To2. The code adds a rectangle and a connector to the first page. The end of the new connector will be attached to the same connection site as the end of the connector named Conn1To2, and the beginning of the new connector will be attached to connection site one on the new rectangle.

Copy code Copy code
Dim shpNew As Shape
Dim intSite As Integer
Dim shpOld As Shape

With ActiveDocument.Pages(1).Shapes

 ' Add new rectangle.
 Set shpNew = .AddShape(Type:=msoShapeRectangle, _
 Left:=450, Top:=190, Width:=200, Height:=100)

 ' Add new connector.
 .AddConnector(Type:=msoConnectorCurve, _
 BeginX:=0, BeginY:=0, EndX:=10, EndY:=10) _
 .Name = "Conn1To3"

 ' Get connection site number of old shape, and set
 ' reference to old shape.
 With .Item("Conn1To2").ConnectorFormat
 intSite = .EndConnectionSite
 Set shpOld = .EndConnectedShape
 End With

 ' Connect new connector to old shape and new rectangle.
 With .Item("Conn1To3").ConnectorFormat
 .EndConnect ConnectedShape:=shpOld, _
 ConnectionSite:=intSite
 .BeginConnect ConnectedShape:=shpNew, _
 ConnectionSite:=1
 End With
End With


WebNavigationBarSets.Application Property (Publisher)

 Copy code hover
[image]

WebNavigationBarSets.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a WebNavigationBarSets object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Document.IsWizard Property (Publisher)

 Copy code hover
[image]

Document.IsWizard Property (Publisher)
Send feedback

Returns True if the specified publication is a publication generated by a Microsoft Publisher wizard. Read-only Boolean.

Syntax

expression .IsWizard

expression A variable that represents an Document object.

Return Value

Boolean

Remarks

Use the Wizard property of the Document object to access the wizard for the specified publication.

Example

The following example tests to determine whether the active document is a wizard publication. If it is, certain wizard properties are returned.

Copy code Copy code
With ActiveDocument
 If .IsWizard = True Then
 Debug.Print .Wizard.Name
 Debug.Print .Wizard.ID
 End If
End With


AdvancedPrintOptions Object (Publisher)

 Copy code hover
[image]

AdvancedPrintOptions Object (Publisher)
See also Send feedback

Represents the advanced print settings for a publication.

Remarks

The properties of the AdvancedPrintOptions object correspond to the options available on the tabs of the Advanced Print Settings dialog box.

Example

Use the AdvancedPrintOptions property of the Document object to return an AdvancedPrintOptions object. The following example tests to determine if the active publication has been set to print as separations. If it has, it is set to print only plates for the inks actually used in the publication, and to not print plates for any pages where a color is not used.

Copy code Copy code
Sub PrintOnlyInksUsed
 With ActiveDocument.AdvancedPrintOptions
 If .PrintMode = pbPrintModeSeparations Then
 .InksToPrint = pbInksToPrintUsed
 .PrintBlankPlates = False
 End If
 End With
End Sub

See also

Other resources

AdvancedPrintOptions Object Members


GlowFormat Object (Publisher)

 Copy code hover
[image]

GlowFormat Object (Publisher)
See also Send feedback

Represents the glow formatting for a shape or a range of shapes.

Version Information

Version Added: Publisher 2013

See also

Other resources

GlowFormat Object Members


PictureFormat.ClearCrop Method (Publisher)

 Copy code hover
[image]

PictureFormat.ClearCrop Method (Publisher)
Send feedback

Removes a picture shape from an image, and resets the crop region to the original extent of the image before cropping. Returns nothing.

Version Information

Version Added: Publisher 2010

Syntax

expression .ClearCrop

expression A variable that represents a PictureFormat object.


MailMergeDataField.UnMapRecipientField Method (Publisher)

 Copy code hover
[image]

MailMergeDataField.UnMapRecipientField Method (Publisher)
Send feedback

Undoes the mapping between the parent MailMergeDataField object in a particular data source and the recipient field in the master data source (combined mail-merge recipient list) to which it is currently mapped.

Version Information

Version Added: Publisher 2007

Syntax

expression .UnMapRecipientField

expression A variable that represents a MailMergeDataField object.

Remarks

This method works only if the parent MailMergeDataField object is mapped to a recipient field. You can use the IsMapped property of the MailMergeDataField object to determine if the object is mapped.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the UnmapRecipientField method to undo the mapping between a data field (column) in a particular data source and a field in the the master data source (combined recipient list) for the publication.

Before running this macro, replace datasourceindex with the index number of a valid data source in the data source collection of the active document, and replace fieldname with the name of the field in the data source that you want to remove from the combined list of recipient fields.

See the Item method topic for an example of how you can use the Name property of the DataSource object to determine the index number of the data source you want.

VBA Copy code Copy code
Public Sub UnmapRecipientField_Example()

 Dim pubMailMergeDataSources As Publisher.MailMergeDataSources
 Dim pubMailMergeDataField As Publisher.MailMergeDataField

 Set pubMailMergeDataSources = ThisDocument.MailMerge.DataSource.DataSources
 Set pubMailMergeDataField = pubMailMergeDataSources.Item(datasourceindex).DataFields.Item("fieldname")

 If pubMailMergeDataField.IsMapped Then

 pubMailMergeDataField.UnMapRecipientField
 Debug.Print "Field unmapped succesfully."

 Else

 Debug.Print "This field is not mapped."

 End If

End Sub


Document.UndoClear Method (Publisher)

 Copy code hover
[image]

Document.UndoClear Method (Publisher)
Send feedback

Clears the list of actions that can be undone for the specified publication. Corresponds to the list of items that appears when you click the arrow beside the Undo button on the Standard toolbar.

Syntax

expression .UndoClear

expression A variable that represents a Document object.

Remarks

Include this method at the end of a macro to keep Microsoft Visual Basic actions from appearing in the Undo box (for example, "VBA-Selection.InsertAfter").

Example

This example clears the list of actions that can be undone for the active publication.

Copy code Copy code
ActiveDocument.UndoClear


Window.WindowState Property (Publisher)

 Copy code hover
[image]

Window.WindowState Property (Publisher)
Send feedback

Returns or sets a PbWindowState constant indicating the state of the Microsoft Publisher window. Read/write.

Syntax

expression .WindowState

expression A variable that represents a Window object.

Return Value

PbWindowState

Remarks

The WindowState property value can be one of these PbWindowState constants.

pbWindowStateMaximize

pbWindowStateMinimize

pbWindowStateNormal

When the state of the window is pbWindowStateNormal, the window is neither maximized nor minimized.

Example

This example maximizes the Publisher window.

VBA Copy code Copy code
ActiveWindow.WindowState = pbWindowStateMaximized


MailMerge Properties (Publisher)

 Copy code hover
[image]

MailMerge Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
DataSource | Returns a MailMergeDataSource object that refers to the data source attached to a mail merge or catalog merge main publication.
DocumentUpdating | Returns or sets a Boolean indicating whether the screen is updated while mail merge code is running. Default is True (the screen is updated). Read/write.
EmailMergeEnvelope | Returns the EmailMergeEnvelope object associated with the parent MailMerge object. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
SuppressBlankLines | True to suppress blank lines when mail merge fields in a mail merge main document are empty. Read/write Boolean.
Type | Gets or sets the type of mail merge represented by the parent MailMerge object. Read/write.
ViewMailMergeFieldCodes | True if merge field names are displayed in a mail merge publication; False if information from the current record is displayed. Read/write Boolean. .
WizardState | Returns or sets a Long indicating the current Mail Merge wizard step for a publication. The WizardState property returns a number that equates to the current Mail Merge wizard step; a zero (0) means the Mail Merge wizard is closed. Read/write.


CalloutFormat.Border Property (Publisher)

 Copy code hover
[image]

CalloutFormat.Border Property (Publisher)
Send feedback

Returns or sets an MsoTriState constant indicating whether the text in the specified callout is surrounded by a border. Read/write.

Syntax

expression .Border

expression A variable that represents a CalloutFormat object.

Return Value

MsoTriState

Remarks

The Border property value can be one of the MsoTriState constants declared in the Microsoft Office type library.

Example

This example adds an oval to the active publication and a callout that points to the oval. The callout text will have a border, but not a vertical accent bar that separates the text from the callout line.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes
 ' Add an oval.
 .AddShape Type:=msoShapeOval, _
 Left:=180, Top:=200, Width:=280, Height:=130

 ' Add a callout.
 With .AddCallout(Type:=msoCalloutTwo, _
 Left:=420, Top:=170, Width:=170, Height:=40)

 ' Add text to the callout.
 .TextFrame.TextRange.Text = "This is an oval"

 ' Add an accent bar to the callout.
 With .Callout
 .Accent = msoFalse
 .Border = msoTrue
 End With
 End With
End With


PbLineSpacingRule Enumeration (Publisher)

 Copy code hover
[image]

PbLineSpacingRule Enumeration (Publisher)
Send feedback

Represents the line spacing for the specified paragraphs.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbLineSpacing1pt5 | 1 | Sets paragraph line spacing to a line and a half.
pbLineSpacingDouble | 2 | Sets paragraph line spacing to two lines.
pbLineSpacingExactly | 4 | Sets paragraph line spacing to exactly the value of the LineSpacing property, even if a larger font is used within the paragraph.
pbLineSpacingMixed | -9999999 | A return value for a paragraph that has line spacing of varying values.
pbLineSpacingMultiple | 5 | A LineSpacing property value must be specified, in number of lines.
pbLineSpacingSingle | 0 | Sets paragraph line spacing to one space.


WebListBox.Application Property (Publisher)

 Copy code hover
[image]

WebListBox.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a WebListBox object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


BorderArts.Item Method (Publisher)

 Copy code hover
[image]

BorderArts.Item Method (Publisher)
See also Send feedback

Returns an individual object in a specified collection.

Syntax

expression .Item(Index)

expression A variable that represents a BorderArts object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The number or name of the field or list box item to return.

Return Value

BorderArt

See also

Concepts

BorderArts Object

Other resources

BorderArts Object Members


Application.PicasToPoints Method (Publisher)

 Copy code hover
[image]

Application.PicasToPoints Method (Publisher)
See also Send feedback

Converts a measurement from picas to points (1 pica = 12 points). Returns the converted measurement as a Single.

Syntax

expression .PicasToPoints(Value)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Value | Required | Single | The pica value to be converted to points.

Return Value

Single

Remarks

Use the PointsToPicas method to convert measurements in points to picas.

Example

This example converts measurements in picas entered by the user to measurements in points.

Copy code Copy code
Dim strInput As String
Dim strOutput As String

Do While True
 ' Get input from user.
 strInput = InputBox( _
 Prompt:="Enter measurement in picas (0 to cancel): ", _
 Default:="0")

 ' Exit the loop if user enters zero.
 If Val(strInput) = 0 Then Exit Do

 ' Evaluate and display result.
 strOutput = Trim(strInput) & " picas = " _
 & Format(Application _
 .Picas ToPoints(Value:=Val(strInput)), _
 "0.00") & " points"

 MsgBox strOutput
Loop

See also

Concepts

Application Object

Other resources

Application Object Members


InlineShapes Members (Publisher)

 Copy code hover
[image]

InlineShapes Members (Publisher)
Send feedback

Contains a collection of Shape objects, which represent objects in the drawing layer, where Shape.IsInline is True. The collection of shapes is limited to shapes within a given text range.

Methods

Name | Description
Item | Returns a Shape object that represents an inline shape contained in a text range. This method is the default member of the InlineShapes collection.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Range | Returns a ShapeRange collection that represents the same set of inline shapes as the InlineShapes collection whose method was called. This allows for miscellaneous formatting of the contained shapes. Read-only.


Application.ValidateAddressVisible Property (Publisher)

 Copy code hover
[image]

Application.ValidateAddressVisible Property (Publisher)
See also Send feedback

Determines whether Validate addresses is available under Refine recipients in the Mail Merge Recipients dialog box in the Microsoft Publisher user interface (UI); and whether Validate addresses is available under Prepare for Mailing on the Publisher Tasks task pane in the Publisher UI. Read/write.

Version Information

Version Added: Publisher 2007

Syntax

expression .ValidateAddressVisible

expression A variable that represents an Application object.

Return Value

Boolean

See also

Concepts

Application Object

Other resources

Application Object Members


MailMergeFilterCriterion.Creator Property (Publisher)

 Copy code hover
[image]

MailMergeFilterCriterion.Creator Property (Publisher)
Send feedback

Returns a Long that represents the application in which the specified object was created. For example, if the object was created in Microsoft Publisher, this property returns the hexadecimal number 4D505542, which represents the string "MSPB." This value can also be represented by the constant.

Syntax

expression .Creator

expression A variable that represents a MailMergeFilterCriterion object.


ShapeNodes.SetSegmentType Method (Publisher)

 Copy code hover
[image]

ShapeNodes.SetSegmentType Method (Publisher)
Send feedback

Sets the segment type of the segment that follows the specified node. If the node is a control point for a curved segment, this method sets the segment type for that curve; this may affect the total number of nodes by inserting or deleting adjacent nodes.

Syntax

expression .SetSegmentType(Index, SegmentType)

expression A variable that represents a ShapeNodes object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The node whose segment type is to be set. Must be a number from 1 to the number of nodes in the specified shape; otherwise, an error occurs.
SegmentType | Required | MsoSegmentType | Specifies the segment type.

Remarks

The SegmentType parameter can be one of the MsoSegmentType constants declared in the Microsoft Office type library and shown in the following table.

msoSegmentCurve

msoSegmentLine

Example

This example changes all straight segments to curved segments in the third shape in the active publication. The shape must be a freeform drawing.

VBA Copy code Copy code
Dim intCount As Integer

With ActiveDocument.Pages(1).Shapes(3).Nodes
 intCount = 1
 Do While intCount <= .Count
 If .Item(intCount).SegmentType = msoSegmentLine Then
 .SetSegmentType _
 Index:=intCount, SegmentType:=msoSegmentCurve
 End If
 intCount = intCount + 1
 Loop
End With


PbPageType Enumeration (Publisher)

 Copy code hover
[image]

PbPageType Enumeration (Publisher)
Send feedback

Represents the page type.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbPageLeftPage | 1 | Left page
pbPageMasterPage | 4 | Master page
pbPageRightPage | 2 | Right page
pbPageScratchPage | 3 | Scratch page


Application.FileDialog Property (Publisher)

 Copy code hover
[image]

Application.FileDialog Property (Publisher)
See also Send feedback

Returns a FileDialog object that represents a single instance of a file dialog box.

Syntax

expression .FileDialog(Type)

expression A variable that represents a Application object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | MsoFileDialogType | The type of dialog box.

Return Value

FileDialog

Remarks

The Type parmater can be one of the MsoFileDialogType constants declared in the Microsoft Office type library.

Example

This example displays the Save As dialog box and stores the file name specified by the user.

VBA Copy code Copy code
Sub ShowSaveAsDialog()
 Dim dlgSaveAs As FileDialog
 Dim strFile As String

 Set dlgSaveAs = Application.FileDialog( _
 Type:=msoFileDialogSaveAs)
 dlgSaveAs.Show
 strFile = dlgSaveAs.SelectedItems(1)
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


CalloutFormat.CustomDrop Method (Publisher)

 Copy code hover
[image]

CalloutFormat.CustomDrop Method (Publisher)
Send feedback

Sets the vertical distance from the edge of the text bounding box to the place where the callout line attaches to the text box.

Syntax

expression .CustomDrop(Drop)

expression A variable that represents a CalloutFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Drop | Required | Variant | The drop distance. Numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

Remarks

The drop distance is normally measured from the top of the text box. However, if the AutoAttach property is set to True and the text box is to the left of the origin of the callout line (the place to which the callout points), the drop distance is measured from the bottom of the text box.

Example

This example sets the custom drop distance to 14 points, and specifies that the drop distance always be measured from the top. For the example to work, the third shape in the active publication must be a callout.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes(3).Callout
 .CustomDrop Drop:=14
 .AutoAttach = False
End With


WrapFormat.Application Property (Publisher)

 Copy code hover
[image]

WrapFormat.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a WrapFormat object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


WizardProperties Methods (Publisher)

 Copy code hover
[image]

WizardProperties Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
FindPropertyById | Returns a WizardProperty object, based on the specified ID, from the collection of wizard properties associated with a publication design or a Design Gallery object's wizard.


TextRange.Expand Method (Publisher)

 Copy code hover
[image]

TextRange.Expand Method (Publisher)
Send feedback

Expands the specified range or selection. Returns or sets a Long that represents the number of specified units added to the range or selection.

Syntax

expression .Expand(Unit)

expression A variable that represents a TextRange object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Required | PbTextUnit | The unit by which to expand the range.

Return Value

Long

Remarks

The Expand method moves both endpoints of a range if necessary; to move only one endpoint of a range, use the MoveStart or MoveEnd method.

The Unit parameter can be one of the PbTextUnit constants declared in the Microsoft Publisher type library.

Example

This example creates a range that refers to the first word in the first shape of the active publication, formats the font for the word, and then it expands the range to reference the entire first paragraph and formats the font for the whole line.

VBA Copy code Copy code
Sub ExpandRange()
 Dim rngText As TextRange

 Set rngText = ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.Words(Start:=1, Length:=1)
 With rngText
 With .Font
 .Size = 20
 .Italic = msoTrue
 End With
 .Expand Unit:=pbTextUnitLine
 .Font.Bold = msoTrue
 End With
End Sub


Application.MailMergeBeforeRecordMerge Event (Publisher)

 Copy code hover
[image]

Application.MailMergeBeforeRecordMerge Event (Publisher)
See also Send feedback

Occurs as a merge is executed for the individual records in a merge.

Syntax

expression .MailMergeBeforeRecordMerge(Doc, Cancel)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The mail merge main document.
Cancel | Required | Boolean | Stops the mail merge process, for the current record only, before it starts.

Remarks

To access the Application object events, declare an Application object variable in the General Declarations section of a code module. Then set the variable equal to the Application object for which you want to access events. For information about using events with the Microsoft Publisher Application object, see Using Events with the Application Object.

Example

This example verifies that the length of the ZIP Code (which in this example is field number six) is less than five and if it is, cancels the merge for that record only.

Copy code Copy code
Private Sub MailMergeApp_MailMergeBeforeRecordMerge(ByVal _
 Doc As Document, Cancel As Boolean)

 Dim intZipLength As Integer

 intZipLength = Len(ActiveDocument.MailMerge _
 .DataSource.DataFields(6).Value)

 'Cancel merge of this record only if
 'the ZIP Code has fewer than five digits
 If intZipLength < 5 Then
 Cancel = True
 End If

End Sub

For this event to occur, you must place the following line of code in the global declarations section of your module and run the following initialization routine.

Copy code Copy code
Private WithEvents MailMergeApp As Application

Sub InitializeMailMergeApp()
 Set MailMergeApp = Publisher.Application
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Shapes.SelectAll Method (Publisher)

 Copy code hover
[image]

Shapes.SelectAll Method (Publisher)
Send feedback

Selects all the shapes in the specified Shapes collection.

Syntax

expression .SelectAll

expression A variable that represents a Shapes object.

Example

This example selects all the shapes on page one of the active publication.

Copy code Copy code
ActiveDocument.Pages(1).Shapes.SelectAll


TabStop Properties (Publisher)

 Copy code hover
[image]

TabStop Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Alignment | Returns or sets a PbTabAlignmentType constant that represents the alignment for the specified tab stop. Read/write.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Leader | Sets or returns a PbTabLeaderType constant that represents the leader character for a tab stop. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Position | Returns or sets a Variant representing the font position relative to the baseline of the text in the specified range. Positive values move the text above the normal baseline, negative values move the text below the baseline. Indeterminate values are returned as -9999.0. Read/write.


LineFormat.Transparency Property (Publisher)

 Copy code hover
[image]

LineFormat.Transparency Property (Publisher)
See also Send feedback

Returns or sets the degree of transparency of lines. Read/write Single.

Version Information

Version Added: Publisher 2013

Syntax

expression .Transparency

expression A variable that represents a LineFormat object.

Return value

Single

Remarks

The value of this property can be expressed as a value between 0.0 (opaque) and 1.0 (clear). This property affects the appearance of solid-colored lines only; it has no effect on the appearance of patterned lines.

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


PbStoryType Enumeration (Publisher)

 Copy code hover
[image]

PbStoryType Enumeration (Publisher)
Send feedback

Represents the type of story.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbStoryContinuedFrom | 2 | Story continued from which text frame.
pbStoryContinuedOn | 3 | Story continued on to which text frame.
pbStoryTable | 0 | Story table.
pbStoryTextFrame | 1 | Story text frame.


AdvancedPrintOptions.IsPostscriptPrinter Property (Publisher)

 Copy code hover
[image]

AdvancedPrintOptions.IsPostscriptPrinter Property (Publisher)
See also Send feedback

Returns True if the active printer is a PostScript printer. Read-only Boolean.

Syntax

expression .IsPostscriptPrinter

expression A variable that represents an AdvancedPrintOptions object.

Return Value

Boolean

Remarks

The following properties of the AdvancedPrintOptions object are only accessible if the active printer is a Postscript printer: HorizontalFlip, VerticalFlip, and NegativeImage.

Use the IsActivePrinter property to specify the active printer for a publication.

Example

The following example determines if the active printer is a PostScript printer. If it is, the active publication is set to print as a horizontally and vertically mirrored, negative image of itself.

Copy code Copy code
Sub PrepToPrintToFilmOnImagesetter()

With ActiveDocument.AdvancedPrintOptions
 If .IsPostscriptPrinter = True Then
 .HorizontalFlip = True
 .VerticalFlip = True
 .NegativeImage = True
 End If
End With

End Sub

See also

Concepts

AdvancedPrintOptions Object

Other resources

AdvancedPrintOptions Object Members


WebHiddenFields Members (Publisher)

 Copy code hover
[image]

WebHiddenFields Members (Publisher)
Send feedback

Represents hidden Web fields that allow a Web page to pass non-visible data to the Web server when a Web page is submitted. The WebHiddenFields object enables control of all the hidden fields attached to a Submit command button.

Methods

Name | Description
Add | Adds a new hidden field to a Web form and returns a Long indicating the number of the new field in the WebHiddenFields collection. New fields are always placed at the end of the current field list.
Delete | Deletes the specified hidden Web field or Web list box item object.
Item | Returns a String corresponding to the value of a hidden field in a Web form or a list item in a Web list box control.
Name | Returns a String that represents the name of a hidden Web field for a Web command button.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


PbWizardNavBarAlignment Enumeration (Publisher)

 Copy code hover
[image]

PbWizardNavBarAlignment Enumeration (Publisher)
Send feedback

Represents the horizontal alignment of the buttons in a Web navigation bar set.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbnbAlignCenter | 2 | Center-aligned
pbnbAlignLeft | 1 | Left-aligned
pbnbAlignRight | 3 | Right-aligned


MailMergeMappedDataField.Parent Property (Publisher)

 Copy code hover
[image]

MailMergeMappedDataField.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a MailMergeMappedDataField object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


ShapeNodes.Parent Property (Publisher)

 Copy code hover
[image]

ShapeNodes.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a ShapeNodes object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


WebListBoxItems.Parent Property (Publisher)

 Copy code hover
[image]

WebListBoxItems.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a WebListBoxItems object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


ShapeRange.HasTable Property (Publisher)

 Copy code hover
[image]

ShapeRange.HasTable Property (Publisher)
Send feedback

Returns msoTrue if the shape represents a TableFrame object or msoFalse if the shape represents any other object type. Read-only.

Syntax

expression .HasTable

expression A variable that represents a ShapeRange object.

Example

This example checks the currently selected shape to see if it is a table. If it is, the code sets the width of column one to one inch (72 points).

VBA Copy code Copy code
Sub IsTable()

 With Application.Selection.ShapeRange
 If .HasTable = msoTrue Then
 .Table.Columns(1).Width = 72
 End If
 End With

End Sub


BorderArt.Name Property (Publisher)

 Copy code hover
[image]

BorderArt.Name Property (Publisher)
See also Send feedback

Returns a String value indicating the name of the specified object. Read-only.

Syntax

expression .Name

expression A variable that represents a BorderArt object.

Remarks

You can use an object's name in conjunction with the Item method or Item property to return a reference to the object if the Item method or property for the collection that contains the object takes a Variant argument. For example, if the value of the Name property for a shape is Rectangle 2, then .Shapes("Rectangle 2") will return a reference to that shape.

The Name property is the default property for the BorderArt, BorderArtFormat, and Label objects.

See also

Concepts

BorderArt Object

Other resources

BorderArt Object Members


Story.Type Property (Publisher)

 Copy code hover
[image]

Story.Type Property (Publisher)
Send feedback

Specifies the type of story. Read-only.

Syntax

expression .Type

expression A variable that represents a Story object.

Remarks

The Type property value can be one of these PbStoryType constants

pbStoryContinuedFrom

pbStoryContinuedOn

pbStoryTable

pbStoryTextFrame


MailMergeDataSources.Application Property (Publisher)

 Copy code hover
[image]

MailMergeDataSources.Application Property (Publisher)
Send feedback

Returns an Application object that represents the creator of the parent MailMergeDataSources collection. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .Application

expression A variable that represents a MailMergeDataSources collection.

Return Value

Object


CalloutFormat.Application Property (Publisher)

 Copy code hover
[image]

CalloutFormat.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a CalloutFormat object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


GroupShapes Members (Publisher)

 Copy code hover
[image]

GroupShapes Members (Publisher)
Send feedback

Represents the individual shapes within a grouped shape. Each shape is represented by a Shape object. Using the Item method with this object, you can work with single shapes within a group without having to ungroup them.

Methods

Name | Description
Item | Returns an individual object in a specified collection.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Font.Glow Property (Publisher)

 Copy code hover
[image]

Font.Glow Property (Publisher)
See also Send feedback

Returns a GlowFormat object that represents the glow formatting for the font used by the specified range of text. Read-only.

Version Information

Version Added: Publisher 2013

Syntax

expression .Glow

expression A variable that represents a Font object.

Return value

GLOWFORMAT

See also

Concepts

Font Object

Other resources

Font Object Members


PageSetup Members (Publisher)

 Copy code hover
[image]

PageSetup Members (Publisher)
Send feedback

Contains information about the page setup for the pages in a publication.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
AvailablePageSizes | Returns the PageSizes collection that contains all the PageSize objects available in the current publication.
HorizontalGap | Returns a Variant that represents the distance between the right edge of one publication page and left edge of the next publication page in the same row when multiple pages are printed on one sheet of printer paper. Read-only.
LeftMargin | Returns a Variant that represents the distance (in points) between the left edge of the printer sheet and the left edge of the publication pages when multiple pages are printed on a single sheet. Read-only.
PageHeight | Returns or sets a Variant that represents the height of the pages in a publication. Read/write.
PageSize | Gets or sets the blank page size for the current publication. Read/write.
PageWidth | Returns or sets a Variant that represents the width of the pages in a publication. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
PublicationLayout | Returns or sets a PbPublicationLayout Enumeration (Publisher) constant that indicates the layout of a publication. Read/write.
TopMargin | Returns a Variant that represents the distance between the top edge of the printer sheet and the top edge of the publication pages. Read-only.
VerticalGap | Returns a Variant that represents the distance (in points) between the bottom edge of one publication page and top edge of the publication page below it when more than one publication page is printed on a single printer page. Read-only.


LineFormat Properties (Publisher)

 Copy code hover
[image]

LineFormat Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
BackColor | Returns or sets a ColorFormat object representing the background color for the specified fill or patterned line. .
BeginArrowheadLength | Returns or sets an MsoArrowheadLength constant indicating the length of the arrowhead at the beginning of the specified line. Read/write.
BeginArrowheadStyle | Returns or sets an MsoArrowheadStyle constant indicating the style of the arrowhead at the beginning of the specified line. Read/write.
BeginArrowheadWidth | Returns or sets an MsoArrowheadWidth constant indicating the width of the arrowhead at the beginning of the specified line. Read/write.
CapStyle | Specifies the style of line endings, as well as the format of dashed lines. Read-write.
DashStyle | Returns or sets an MsoLineDashStyle constant indicating the dash style for the specified line. Read/write.
EndArrowheadLength | Returns or sets an MsoArrowheadLength constant indicating the length of the arrowhead at the end of the specified line. Read/write.
EndArrowheadStyle | Returns or sets an MsoArrowheadStyle constant indicating the style of the arrowhead at the end of the specified line. Read/write.
EndArrowheadWidth | Returns or sets an MsoArrowheadWidth constant indicating the width of the arrowhead at the end of the specified line. Read/write.
ForeColor | Returns or sets a ColorFormat object representing the foreground color for the fill, line, or shadow. Read/write.
GradientAngle | Returns or sets the angle of the gradient fill for the specified fill format. Read/write.
GradientColorType | Returns the gradient color type for the specified line. Read-only.
GradientStyle | Returns the gradient style for the specified line. Read-only.
GradientVariant | Returns the gradient variant for the specified line as an integer value, usually from 1 to 4. Read-only.
InsetPen | Returns or sets an MsoTriState constant indicating whether a specified shape's lines are drawn inside its boundaries. Read/write.
JoinStyle | Returns of sets the join style for the specified line. Read-write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Pattern | Returns or sets an MsoPatternType constant that represents the pattern applied to the specified fill or line.
PresetGradientType | Returns the preset gradient type for the specified line. Read-only.
Style | Returns or sets an MsoLineStyle constant that represents the style of line to apply to a shape or border. Read/write.
Transparency | Returns or sets the degree of transparency of lines. Read/write Single.
Type | Returns the line fill-format type. Read-only.
Visible | Returns or sets an MsoTriState constant indicating whether the specified object or the formatting applied to the specified object is visible. Read/write.
Weight | Returns or sets a Variant indicating the thickness of the specified line or cell border.


PictureFormat.Filename Property (Publisher)

 Copy code hover
[image]

PictureFormat.Filename Property (Publisher)
Send feedback

Returns a String that represents the file name of the specified picture or OLE object. Read-only.

Syntax

expression .Filename

expression A variable that represents a PictureFormat object.

Return Value

String

Remarks

For linked pictures and OLE objects, the returned string represents the full path and file name of the picture. For embedded pictures and OLE objects, the returned string represents the file name only.

To determine whether a shape represents a linked picture, use either the Type property of the Shape object, or the IsLinked property of the PictureFormat object.

Example

The following example returns selected image properties for each picture in the active publication.

Copy code Copy code
Dim pgLoop As Page
Dim shpLoop As Shape

For Each pgLoop In ActiveDocument.Pages
 For Each shpLoop In pgLoop.Shapes
 If shpLoop.Type = pbPicture Or shpLoop.Type = pbLinkedPicture Then

 With shpLoop.PictureFormat

 If .IsEmpty = msoFalse Then

 Debug.Print "File Name: " & .Filename
 Debug.Print "Horizontal Scaling: " & .HorizontalScale & "%"
 Debug.Print "Vertical Scaling: " & .VerticalScale & "%"
 Debug.Print "File size in publication: " & .FileSize & " bytes"

 End If

 End With
 End If
 Next shpLoop
Next pgLoop


MailMergeMappedDataFields.Application Property (Publisher)

 Copy code hover
[image]

MailMergeMappedDataFields.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a MailMergeMappedDataFields object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


PrintableRect Properties (Publisher)

 Copy code hover
[image]

PrintableRect Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Height | Returns a Single that represents the height, in points, of the printable rectangle. Read-only.
Left | Returns a Single indicating the distance (in points) from the left edge of the printer sheet to the left edge of the printable rectangle. Read-only.
Parent | Returns an object that represents the parent object of the specified object. Read-only.
Top | Returns the a Single that represents the distance (in points) from the top edge of the printer sheet to the top edge of the printable rectangle. Read-only.
Width | Returns a Single that represents the printable rectangle. Read-only.


TabStop Object (Publisher)

 Copy code hover
[image]

TabStop Object (Publisher)
Send feedback

Represents a single tab stop. The TabStop object is a member of the TabStops collection. The TabStops collection represents all the custom and default tab stops in a paragraph or group of paragraphs.

Remarks

Set the DefaultTabStop property to adjust the spacing of default tab stops.

Example

Use Tabs (index), where index is the location of the tab stop (in points) or the index number, to return a single TabStop object. Tab stops are indexed numerically from left to right along the ruler. The following example removes the first custom tab stop from the selected paragraphs.

Copy code Copy code
Sub ClearTabStop()
 Selection.TextRange.ParagraphFormat.Tabs(1).Clear
End Sub

The following example adds a right-aligned tab stop positioned at 2 inches to the selected paragraphs.

Copy code Copy code
Sub ChangeTabStop()
 Selection.TextRange.ParagraphFormat.Tabs(2) _
 .Alignment = pbTabAlignmentTrailing
End Sub

Use the Add method to add a tab stop. The following example adds two tab stops to the selected paragraphs. The first tab stop is a left-aligned tab with a dotted tab leader positioned at 1 inch (72 points). The second tab stop is centered and is positioned at 2 inches.

Copy code Copy code
Sub AddNewTabs()
 With Selection.TextRange.ParagraphFormat.Tabs
 .Add Position:=InchesToPoints(1), _
 Leader:=pbTabLeaderDot, Alignment:=pbTabAlignmentLeading
 .Add Position:=InchesToPoints(2), _
 Leader:=pbTabLeaderNone, Alignment:=pbTabAlignmentCenter
 End With
End Sub


WebTextBox Object (Publisher)

 Copy code hover
[image]

WebTextBox Object (Publisher)
Send feedback

Represents a Web text box control. The WebTextBox object is a member of the Shape object.

Example

Use the AddWebControl method to create new Web option button. Use the WebTextBox property to access a Web text box control shape. This example creates a new Web text box, specifies default text, indicates that entry is required, and limits entry to 50 characters.

Copy code Copy code
Sub CreateWebTextBox()
 With ActiveDocument.Pages(1).Shapes
 With .AddWebControl(Type:=pbWebControlSingleLineTextBox, _
 Left:=100, Top:=100, Width:=150, Height:=15).WebTextBox
 .DefaultText = "Please Enter Your Full Name"
 .RequiredControl = msoTrue
 .Limit = 50
 End With
 End With
End Sub


ColorCMYK Properties (Publisher)

 Copy code hover
[image]

ColorCMYK Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Black | Sets or returns a Long that represents the black component of a CMYK color. Value can be any number between 0 and 255. Read/write.
Cyan | Sets or returns a Long that represents the cyan component of a CMYK color. Value can be any number between 0 and 255. Read/write.
Magenta | Sets or returns a Long that represents the magenta component of a CMYK color. Value can be any number between 0 and 255. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Yellow | Sets or returns a Long that represents the yellow component of a CMYK color. Value can be any number between 0 and 255. Read/write.


Shape.Top Property (Publisher)

 Copy code hover
[image]

Shape.Top Property (Publisher)
Send feedback

Returns or sets a Variant that represents the distance between the top of the page and the top of a shape. Read/write.

Syntax

expression .Top

expression A variable that represents a Shape object.

Example

This example changes the position, size, and type of shape of the first shape on the first page of the active publication. This example assumes there is at least one shape on the first page of the active publication.

VBA Copy code Copy code
Sub MoveSizeChangeShape()
 With ActiveDocument.Pages(1).Shapes(1)
 .Top = 72
 .Left = 72
 .Width = 150
 .Height = 150
 .AutoShapeType = msoShape5pointStar
 End With
End Sub


PictureFormat.IsRecolored Property (Publisher)

 Copy code hover
[image]

PictureFormat.IsRecolored Property (Publisher)
Send feedback

Returns True if the image represented by the parent PictureFormat object has been recolored, either in the user interface or by using the PictureFormat.Recolor method. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .IsRecolored

expression A variable that represents a PictureFormat object.

Return Value

MsoTriState


Tags Object (Publisher)

 Copy code hover
[image]

Tags Object (Publisher)
Send feedback

A collection of Tag objects that represents tags or custom properties applied to a shape, shape range, page, or publication.

Example

Use the Tags property to access the Tags collection. Use the Add method of the Tags collection to add a Tag object to a shape, shape range, page, or publication. This example adds a tag to each oval shape on the first page of the active publication.

Copy code Copy code
Sub AddNewTag()
 Dim shp As Shape
 With ActiveDocument.Pages(1)
 For Each shp In .Shapes
 If InStr(1, shp.Name, "Oval") > 0 Then
 shp.Tags.Add Name:="Shape", Value:="Oval"
 End If
 Next shp
 End With
End Sub

Use the Count property to determine if a shape, shape range, page, or publication contains one or more Tag objects. This example fills all shapes on the first page of the active publication if the shape's first tag has a value of Oval.

Copy code Copy code
Sub FormatTaggedShapes()
 Dim shp As Shape
 With ActiveDocument.Pages(1)
 For Each shp In .Shapes
 If shp.Tags.Count > 0 Then
 If shp.Tags(1).Value = "Oval" Then
 shp.Fill.ForeColor.RGB = RGB(Red:=255, Green:=0, Blue:=0)
 End If
 End If
 Next shp
 End With
End Sub


Adjustments Members (Publisher)

 Copy code hover
[image]

Adjustments Members (Publisher)
Send feedback

Contains a collection of adjustment values for the specified AutoShape or WordArt object.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Item | Returns or sets a Variant indicating the adjustment value specified by the Index argument. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


MailMergeDataFields Methods (Publisher)

 Copy code hover
[image]

MailMergeDataFields Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Item | Returns a MailMergeDataField object from the specified MailMergeDataFields object.


ColorSchemes Properties (Publisher)

 Copy code hover
[image]

ColorSchemes Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Item | Returns the specified ColorScheme object from a ColorSchemes collection. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Columns Properties (Publisher)

 Copy code hover
[image]

Columns Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


ColorsInUse.Parent Property (Publisher)

 Copy code hover
[image]

ColorsInUse.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a ColorsInUse object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


TextStyle.Font Property (Publisher)

 Copy code hover
[image]

TextStyle.Font Property (Publisher)
Send feedback

Sets or returns a Font object that represents character formatting attributes applied to the specified object. Read/write.

Syntax

expression .Font

expression A variable that represents a TextStyle object.

Example

This example selects text and formats the font as bold.

Copy code Copy code
Sub test2()
 With Selection.TextRange
 .Start = 50
 .End = 150
 .Font.Bold = msoTrue
 End With
End Sub


WebCommandButton.DataRetrievalMethod Property (Publisher)

 Copy code hover
[image]

WebCommandButton.DataRetrievalMethod Property (Publisher)
Send feedback

Sets or returns a PbSubmitDataRetrievalMethodType that represents the way data from a Web form is processed. Read/write.

Syntax

expression .DataRetrievalMethod

expression A variable that represents a WebCommandButton object.

Return Value

PbSubmitDataRetrievalMethodType

Remarks

The DataRetrievalMethod property value can be one of the PbSubmitDataRetrievalMethodType constants declared in the Microsoft Publisher type library.

Example

This example sets Microsoft Publisher to process data on the Web form in the current publication by sending an e-mail message to a specified e-mail address.

VBA Copy code Copy code
Sub WebFormData()
 With ThisDocument.Pages(1).Shapes(1).WebCommandButton
 .DataRetrievalMethod = pbSubmitDataRetrievalEmail
 .EmailAddress = "someone@example.com"
 .EmailSubject = "Web form data"
 End With
End Sub


Section.Parent Property (Publisher)

 Copy code hover
[image]

Section.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a Section object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Font Methods (Publisher)

 Copy code hover
[image]

Font Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Duplicate | Creates a duplicate of the specified Font object and then returns the new Font object.
GetScriptName | Returns a String that represents the name of the font script being used in a text range.
Grow | Increases the font size to the next available size.
Reset | Removes manual paragraph or text formatting from the specified object and leaves only the formatting specified by the current text style.
SetScriptName | Sets the name of the font script to use in a text range.
Shrink | Decreases the font size to the next available size. If the selection or range contains more than one font size, each size is decreased to the next available setting.


Hyperlink Properties (Publisher)

 Copy code hover
[image]

Hyperlink Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Address | Returns or sets a String that represents the URL address for a hyperlink. Read/write.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
EmailSubject | Sets or returns a String that represents the subject for e-mail messages generated to process Web form data. Read/write.
PageID | Returns or sets a Long indicating the page in the publication that is the destination for the specified hyperlink. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Range | Returns a TextRange object representing the base text to which the specified hyperlink has been applied.
Shape | Returns a Shape object that represents the shape associated with a hyperlink.
TargetType | Returns a PbHlinkTargetType constant that represents the type of hyperlink. Read-only.
TextToDisplay | Returns or sets a String that represents the text displayed for a hyperlink. Read/write.
Type | Returns an MsoHyperlinkType constant that represents the hyperlink type. Read-only.


WebTextBox.ReturnDataLabel Property (Publisher)

 Copy code hover
[image]

WebTextBox.ReturnDataLabel Property (Publisher)
Send feedback

Returns or sets a String that represents the text used by the Web page to label the specified Web object when the page is submitted. Read/write.

Syntax

expression .ReturnDataLabel

expression A variable that represents a WebTextBox object.

Example

This example creates a new Web text box and specifies the label for the text in the text box when the page is submitted.

Copy code Copy code
Sub LabelWebTextBoxControl()
 With ActiveDocument.Pages(1).Shapes _
 .AddWebControl(Type:=pbWebControlSingleLineTextBox, _
 Left:=100, Top:=100, Width:=300, Height:=15).WebTextBox
 .DefaultText = "Please enter your name here"
 .Limit = 70
 .RequiredControl = msoTrue
 .ReturnDataLabel = "Full_Name"
 End With
End Sub


ReaderSpread.Application Property (Publisher)

 Copy code hover
[image]

ReaderSpread.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a ReaderSpread object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


ObjectVerbs.Application Property (Publisher)

 Copy code hover
[image]

ObjectVerbs.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents an ObjectVerbs object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Fields Properties (Publisher)

 Copy code hover
[image]

Fields Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


ParagraphFormat Members (Publisher)

 Copy code hover
[image]

ParagraphFormat Members (Publisher)
Send feedback

Represents all the formatting for a paragraph.

Methods

Name | Description
Duplicate | Creates a duplicate of the specified ParagraphFormat object and then returns the new ParagraphFormat object.
Reset | Removes manual paragraph or text formatting from the specified object and leaves only the formatting specified by the current text style.
SetLineSpacing | Formats the line spacing of specified paragraphs.
SetListType | Sets the list type of the specified ParagraphFormat object. .

Properties

Name | Description
Alignment | Returns or sets a PbParagraphAlignmentType constant that represents the alignment for the specified paragraphs. Read/write.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
AttachedToText | True if the Font or ParagraphFormat object is attached to a TextRange object. If the object is attached to a TextRange object, the document will be updated when properties of the object are changed. If the object is not attached, nothing in the document will be changed until the object is applied to a TextRange or Style object. Read-only Boolean.
CharBasedFirstLineIndent | Returns or sets the value of the first line indent (in East Asian character width). Read/write Long.
FirstLineIndent | Returns or sets a Variant that represents the amount of space (measured in points) to indent the first line in a paragraph. Read/write.
KashidaPercentage | Returns or sets a Long indicating the percentage by which kashidas are to be lengthened for the specified paragraphs. Valid values are from 0 to 100. Read/write.
KeepLinesTogether | Sets or returns an MsoTriState that indicates whether all lines in the specified paragraph will remain in the same text box. Read/write.
KeepWithNext | Sets or returns an MsoTriState that indicates whether the following paragraph will remain in the same text box as the specified paragraph. Read/write.
LeftIndent | Returns or sets a Variant that represents the left indent value (in points) for the specified paragraphs. Read/write.
LineSpacing | Returns or sets a Variant that represents the line spacing (in number of lines) for the specified paragraphs. Read/write.
LineSpacingRule | Returns or sets a PbLineSpacingRule that represents the line spacing for the specified paragraphs. Read/write.
ListBulletFontName | Sets or retrieves a String representing the list bullet font name from the specified paragraphs. Read/write.
ListBulletFontSize | Sets or retrieves a Single that represents the list bullet font size from the specified paragraphs. Read/write.
ListBulletText | Returns a String representing the list bullet text from the specified paragraphs. Read-only.
ListIndent | Returns or sets a Single that represents the list indent value (in points) for the specified ParagraphFormat object. Read/write.
ListNumberSeparator | Sets or retrieves a PbListSeparator constant that represents the list separator of the specified paragraphs. Read/write.
ListNumberStart | Sets or retrieves a Long that represents the starting number of a list. Read/write.
ListType | Returns a PbListType constant from the specified ParagraphFormat object. Read-only.
LockToBaseLine | Returns an MsoTristate that represents whether or not text will be positioned along baseline guides. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
RightIndent | Returns or sets a Variant that represents the right indent (in points) for the specified paragraphs. Read/write.
SpaceAfter | Returns or sets a Variant that represents the amount of spacing (in points) after one or more paragraphs. Read/write.
SpaceBefore | Returns or sets a Variant that represents the amount of spacing (in points) before one or more paragraphs. Read/write.
StartInNextTextBox | Returns or sets an MsoTriState constant that represents whether to always start the selected paragraph in the next linked text box. Read/write.
Tabs | Returns a TabStops object representing the custom and default tabs for a paragraph or group of paragraphs.
TextDirection | Returns or sets a PbTextDirection constant indicating the direction in which text flows in the specified paragraph. Read/write.
TextStyle | Returns or sets a Variant that represents the text style applied to a paragraph. Read/write.
UseCharBasedFirstLineIndent | Returns or sets an MsoTriState constant that specifies whether a paragraph is indented using East Asian character width. Read/write.
WidowControl | Sets or returns an MsoTriState that represents whether or not the first or last line of the specified paragraph can appear by itself in a text box. Read/write.


Application.SnapToObjects Property (Publisher)

 Copy code hover
[image]

Application.SnapToObjects Property (Publisher)
See also Send feedback

True for Microsoft Publisher to use objects on a page to line up other objects. Read/write Boolean.

Syntax

expression .SnapToObjects

expression A variable that represents a Application object.

Return Value

Boolean

Example

This example adds horizontal and vertical ruler guides every half inch on the first page and sets the options to align objects on the page to the guides.

VBA Copy code Copy code
Sub SetSnapOptions()
 Dim intCount As Integer
 Dim intPos As Integer
 With ActiveDocument.Pages(1).RulerGuides
 For intCount = 1 To 16
 intPos = intPos + 36
 .Add Position:=intPos, Type:=pbRulerGuideTypeVertical
 Next
 intPos = 0
 For intCount = 1 To 21
 intPos = intPos + 36
 .Add Position:=intPos, Type:=pbRulerGuideTypeHorizontal
 Next
 End With
 With Application
 .SnapToGuides = True
 .SnapToObjects = True
 End With
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


TextFrame.HasPreviousLink Property (Publisher)

 Copy code hover
[image]

TextFrame.HasPreviousLink Property (Publisher)
Send feedback

Returns msoTrue if the specified text frame has a valid link to a backward text box and msoFalse if it does not. Read-only.

Syntax

expression .HasPreviousLink

expression A variable that represents a TextFrame object.

Return Value

MsoTriState

Example

This example breaks all links in the document to the first specified text frame if links exist. This example assumes that there is at least one shape on the first page of the active publication.

VBA Copy code Copy code
Sub AddPreviousNextLinkPages()
 With ActiveDocument.Pages(1).Shapes(1).TextFrame
 If .HasNextLink Then .BreakForwardLink
 If .HasPreviousLink Then .PreviousLinkedTextFrame _
 .BreakForwardLink
 End With
End Sub


BuildingBlocks.Parent Property (Publisher)

 Copy code hover
[image]

BuildingBlocks.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a BuildingBlocks object.


CellRange Object (Publisher)

 Copy code hover
[image]

CellRange Object (Publisher)
Send feedback

A collection of Cell objects in a table column or row. The CellRange collection represents all the cells in the specified column or row.

Remarks

Although the collection object is named CellRange and is shown in the Object Browser, this keyword is not used in programming the Microsoft Publisher object model. The keyword Cells is used instead.

You cannot programmatically add to or delete individual cells from a Publisher table. Use the AddTable method with the Shapes collection to add a new table to a publication. Use the Add method of the Columns or Rows collections to add a column or row to a table. Use the Delete method of the Columns or Rows collections to delete a column or row from a table.

Example

Use the Cells property to return the CellRange collection. This example merges the cells in first column of the table.

Copy code Copy code
Sub MergeCellsInFirstColumn()
 With ActiveDocument.Pages(1).Shapes(1).Table
 .Cells(StartRow:=1, StartColumn:=1, _
 EndRow:=.Rows.Count, EndColumn:=1).Select
 End With
 Selection.TableCellRange.Merge
End Sub

Use the Count property to return the number of cells in a row, column, table or selection. This example displays a message with the number of cells the specified table.

Copy code Copy code
Sub NumberOfTableCells()
 MsgBox ActiveDocument.Pages(1).Shapes(1).Table _
 .Cells.Count
End Sub


PictureFormat.OriginalColorsInPalette Property (Publisher)

 Copy code hover
[image]

PictureFormat.OriginalColorsInPalette Property (Publisher)
Send feedback

Returns a Long that represents the number of colors in the specified linked picture's palette. Read-only.

Syntax

expression .OriginalColorsInPalette

expression A variable that represents an PictureFormat object.

Return Value

Long

Remarks

This property only applies to linked pictures or OLE objects that are not TrueColor (that is, they contain color data of less than 24 bits per channel.) Returns "Permission Denied" for shapes representing embedded or pasted pictures and OLE objects, or linked pictures that are TrueColor.

Use either of the following properties to determine whether a shape represents a linked picture:

  • The Type property of the Shape object

  • The IsLinked property of the PictureFormat object

Use the OriginalIsTrueColor property to determine whether a linked picture contains color data of 24 bits per channel or greater.

Example

The following example returns a list of all pictures in the active publication that are not TrueColor. The number of colors in each picture's palette is returned, and if the picture is linked and the linked picture is not TrueColor, the number of colors in its palette is also returned.

VBA Copy code Copy code
Sub PictureColorInformation()
Dim pgLoop As Page
Dim shpLoop As Shape

For Each pgLoop In ActiveDocument.Pages
 For Each shpLoop In pgLoop.Shapes
 If shpLoop.Type = pbLinkedPicture Or shpLoop.Type = pbPicture Then

 With shpLoop.PictureFormat
 If .IsEmpty = msoFalse Then

 If .IsTrueColor = msoFalse Then
 Debug.Print .Filename
 Debug.Print "This picture has " & .ColorsInPalette & " colors."
 If .IsLinked = msoTrue Then
 If .OriginalIsTrueColor = msoFalse Then
 Debug.Print "The linked picture has " & _
 .OriginalColorsInPalette & " colors."
 End If
 End If
 End If

 End If
 End With

 End If
 Next shpLoop
Next pgLoop

End Sub


LineFormat.BeginArrowheadLength Property (Publisher)

 Copy code hover
[image]

LineFormat.BeginArrowheadLength Property (Publisher)
Send feedback

Returns or sets an MsoArrowheadLength constant indicating the length of the arrowhead at the beginning of the specified line. Read/write.

Syntax

expression .BeginArrowheadLength

expression A variable that represents a LineFormat object.

Return Value

MsoArrowheadLength

Remarks

The BeginArrowheadLength property value can be one of the MsoArrowheadLength constants declared in the Microsoft Office type library.

Use the EndArrowheadLength property to return or set the length of the arrowhead at the end of the line.

Example

This example adds a line to the active publication. There is a short, narrow oval on the line's starting point and a long, wide triangle on its endpoint.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes _
 .AddLine(BeginX:=100, BeginY:=100, _
 EndX:=200, EndY:=300).Line
 .BeginArrowheadLength = msoArrowheadShort
 .BeginArrowheadStyle = msoArrowheadOval
 .BeginArrowheadWidth = msoArrowheadNarrow
 .EndArrowheadLength = msoArrowheadLong
 .EndArrowheadStyle = msoArrowheadTriangle
 .EndArrowheadWidth = msoArrowheadWide
End With


WebNavigationBarSet.DeleteSetAndInstances Method (Publisher)

 Copy code hover
[image]

WebNavigationBarSet.DeleteSetAndInstances Method (Publisher)
Send feedback

Deletes a Web navigation bar set and all instances of it in the current document.

Syntax

expression .DeleteSetAndInstances

expression A variable that represents a WebNavigationBarSet object.

Example

The following example iterates through the WebNavigationBarSets collection and deletes each set from the active document.

Copy code Copy code
Dim objWebNavBarSet As WebNavigationBarSet
For Each objWebNavBarSet In ActiveDocument.WebNavigationBarSets
 objWebNavBarSet.DeleteSetAndInstances
Next objWebNavBarSet


Document.Save Method (Publisher)

 Copy code hover
[image]

Document.Save Method (Publisher)
Send feedback

Saves the specified publication.

Syntax

expression .Save

expression A variable that represents a Document object.

Remarks

If the publication has not been previously saved, calling the Save method is equivalent to calling the SaveAs method with the FileName argument set to the value of the publication's Name property. If the publication has been previously saved, the Save method saves the current version of the publication in the format in which it was opened and in the location to which it was last saved.

Calling the Save method always performs saves in the foreground regardless of whether background saves are enabled.

Example

This example saves the active publication if it has changed since it was last saved.

Copy code Copy code
If ActiveDocument.Saved = False Then ActiveDocument.Save


RulerGuide.Parent Property (Publisher)

 Copy code hover
[image]

RulerGuide.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a RulerGuide object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


PbPictureResolution Enumeration (Publisher)

 Copy code hover
[image]

PbPictureResolution Enumeration (Publisher)
Send feedback

Constants passed to the SaveAsPicture method and specifying the resolution in which the picture is to be saved.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbPictureResolutionCommercialPrint_300dpi | 3 | 300 dpi
pbPictureResolutionDefault | 0 | Default
pbPictureResolutionDesktopPrint_150dpi | 2 | 150 dpi
pbPictureResolutionWeb_96dpi | 1 | 96 dpi


ThreeDFormat.ResetRotation Method (Publisher)

 Copy code hover
[image]

ThreeDFormat.ResetRotation Method (Publisher)
Send feedback

Resets the extrusion rotation around the x-axis (horizontal) and the y-axis (vertical) to 0 (zero) so that the front of the extrusion faces forward.

Syntax

expression .ResetRotation

expression A variable that represents a ThreeDFormat object.

Remarks

This method doesn't reset the rotation around the z-axis (extends outward from the plane of the publication).

To set the extrusion rotation around the x-axis and the y-axis to anything other than 0, use the RotationX and RotationY properties of the ThreeDFormat object.

To set the extrusion rotation around the z-axis, use the Rotation property of the Shape object that represents the extruded shape.

Example

This example resets the rotation around the x-axis and the y-axis to zero for the extrusion of the first shape in the active publication.

Copy code Copy code
ActiveDocument.Pages(1).Shapes(1).ThreeD _
 .ResetRotation


TextEffectFormat.Parent Property (Publisher)

 Copy code hover
[image]

TextEffectFormat.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a TextEffectFormat object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


RulerGuides.Count Property (Publisher)

 Copy code hover
[image]

RulerGuides.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a RulerGuides object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


RulerGuides.Parent Property (Publisher)

 Copy code hover
[image]

RulerGuides.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a RulerGuides object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


WebCheckBox.Parent Property (Publisher)

 Copy code hover
[image]

WebCheckBox.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a WebCheckBox object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


PbCollapseDirection Enumeration (Publisher)

 Copy code hover
[image]

PbCollapseDirection Enumeration (Publisher)
Send feedback

The direction in which to collapse the range or selection.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbCollapseEnd | 2 | Collapse at the end.
pbCollapseStart | 1 | Collapse at the start.


TextRange.WordsCount Property (Publisher)

 Copy code hover
[image]

TextRange.WordsCount Property (Publisher)
Send feedback

Returns the number of words in the text range represented by the parent TextRange object. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .WordsCount

expression A variable that represents a TextRange object.

Return Value

Long


Field Object (Publisher)

 Copy code hover
[image]

Field Object (Publisher)
Send feedback

Represents a field. The Field object is a member of the Fields collection. The Fields collection represents the fields in a selection, range, or publication.

Remarks

The pbFieldPageNumber constant is a member of the PbFieldType group of constants, which includes all the various field types.

Example

Use Fields (index), where index is the index number, to return a single Field object. The index number represents the position of the field in the selection, range, or publication. The following counts the number of fields in the active publication and displays the count in a message.

Copy code Copy code
Sub CountFields()
 Dim pagPage As Page
 Dim shpShape As Shape
 Dim fldField As Field
 Dim intFields As Integer
 Dim intCount As Integer

 For Each pagPage In ActiveDocument.Pages
 For Each shpShape In pagPage.Shapes
 If shpShape.Type = pbTextFrame Then
 intCount = intCount + shpShape.TextFrame.TextRange.Fields.Count
 End If
 Next
 Next
 If intCount > 0 Then
 MsgBox "You have " & intCount & " fields in your publication."
 Else
 MsgBox "You have no fields in your publication."
 End If
End Sub


LineFormat.BeginArrowheadStyle Property (Publisher)

 Copy code hover
[image]

LineFormat.BeginArrowheadStyle Property (Publisher)
Send feedback

Returns or sets an MsoArrowheadStyle constant indicating the style of the arrowhead at the beginning of the specified line. Read/write.

Syntax

expression .BeginArrowheadStyle

expression A variable that represents a LineFormat object.

Return Value

MsoArrowheadStyle

Remarks

The BeginArrowheadStyle property value can be one of the MsoArrowheadStyle constants declared in the Microsoft Office type library.

Use the EndArrowheadStyle property to return or set the style of the arrowhead at the end of the line.

Example

This example adds a line to the active publication. There is a short, narrow oval on the line's starting point and a long, wide triangle on its endpoint.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes _
 .AddLine(BeginX:=100, BeginY:=100, _
 EndX:=200, EndY:=300).Line
 .BeginArrowheadLength = msoArrowheadShort
 .BeginArrowheadStyle = msoArrowheadOval
 .BeginArrowheadWidth = msoArrowheadNarrow
 .EndArrowheadLength = msoArrowheadLong
 .EndArrowheadStyle = msoArrowheadTriangle
 .EndArrowheadWidth = msoArrowheadWide
End With


Stories.Item Method (Publisher)

 Copy code hover
[image]

Stories.Item Method (Publisher)
Send feedback

Returns an individual object in a specified collection.

Syntax

expression .Item(Index)

expression A variable that represents a Stories object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The number of the object to return.

Return Value

Story


Page.Tags Property (Publisher)

 Copy code hover
[image]

Page.Tags Property (Publisher)
Send feedback

Returns a Tags collection representing tags or custom properties applied to a shape, shape range, page, or publication.

Syntax

expression .Tags

expression A variable that represents a Page object.

Example

This example adds a tag to each oval shape on the first page of the active publication.

Copy code Copy code
Dim shp As Shape
Dim tagsAll As Tags
Dim tagLoop As Tag
Dim blnTag As Boolean

With ActiveDocument.Pages(1)
 For Each shp In .Shapes
 If shp.AutoShapeType = msoShapeOval Then
 Set tagsAll = shp.Tags
 blnTag = False

 For Each tagLoop In tagsAll
 If tagLoop.Name = "Shape" Then
 blnTag = True
 Exit For
 End If
 Next tagLoop

 If blnTag = False Then
 tagsAll.Add Name:="Shape", Value:="Oval"
 End If
 End If
 Next shp
End With


Shapes.AddWebControl Method (Publisher)

 Copy code hover
[image]

Shapes.AddWebControl Method (Publisher)
Send feedback

Adds a new Shape object representing a Web form control to the specified Shapes collection.

Syntax

expression .AddWebControl(Type, Left, Top, Width, Height, LaunchPropertiesWindow)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | PbWebControlType | Specifies the type of Web form control to add. An error occurs if pbWebControlWebComponent is used.
Left | Required | Variant | The position of the left edge of the shape representing the Web form control.
Top | Required | Variant | The position of the top edge of the shape representing the Web form control.
Width | Required | Variant | The width of the shape representing the Web form control. For command buttons, this parameter is ignored.
Height | Required | Variant | The height of the shape representing the Web form control. For command buttons, this parameter is ignored.
LaunchPropertiesWindow | Optional | Boolean | Not supported. Default is False; an error occurs if this argument is set to True.

Return Value

Shape

Remarks

For the Left, Top, Width, and Height parameters, numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

When adding a hot spot to a Web control by using the pbWebControlHotSpot constant, the URL is specified by the Hyperlink property.

Note that the Shape.Fill property, which returns a FillFormat object, and the Shape.Line property, which returns a LineFormat object, cannot be accessed from a hot spot shape. A run-time error is returned if attempting to access these properties from a hot spot shape.

The Type parameter can be one of the PbWebControlType constants declared in the Microsoft Publisher type library and shown in the following table.

Constant | Description
pbWebControlCheckBox | Adds a check box.
pbWebControlCommandButton | Adds a command button.
pbWebControlHotSpot | Adds a hot spot.
pbWebControlHTMLFragment | Adds an HTML fragment.
pbWebControlListBox | Adds a list box.
pbWebControlMultiLineTextBox | Adds a multiple-line text area.
pbWebControlOptionButton | Adds an option button.
pbWebControlSingleLineTextBox | Adds a single-line text box.
pbWebControlWebComponent | Not used for this method.

Example

The following example adds a Web form check box control to the first page of the active publication.

VBA Copy code Copy code
Dim shpCheckBox As Shape

Set shpCheckBox = ActiveDocument.Pages(1).Shapes.AddWebControl _
 (Type:=pbWebControlCheckBox, _
 Left:=216, Top:=216, _
 Width:=18, Height:=18)

The following example adds hot spots to a shape on page four of the active Web publication. First, a four-point star AutoShape is added to the page. Next, a hot spot is added to each arm of the star by using the AddWebControl method with a Type of pbWebControlHotSpot. Finally, a hyperlink is added to each hot spot by using the Hyperlink property of each hot spot shape.

VBA Copy code Copy code
Dim theDoc As Document
Dim theStar As Shape
Dim theWC1 As Shape
Dim theWC2 As Shape
Dim theWC3 As Shape
Dim theWC4 As Shape

Set theDoc = ActiveDocument
Set theStar = theDoc.Pages(4).Shapes.AddShape _
 (Type:=msoShape4pointStar, Left:=200, Top:=25, _
 Width:=200, Height:=200)

With theDoc.Pages(4).Shapes

 Set theWC1 = .AddWebControl(Type:=pbWebControlHotSpot, _
 Left:=280, Top:=25, Width:=40, Height:=80)
 With theWC1
 .Hyperlink.Address = "http://www.contoso.com/page1.htm"
 End With

 Set theWC2 = .AddWebControl(Type:=pbWebControlHotSpot, _
 Left:=320, Top:=105, Width:=80, Height:=40)
 With theWC2
 .Hyperlink.Address = "http://www.contoso.com/page2.htm"
 End With

 Set theWC3 = .AddWebControl(Type:=pbWebControlHotSpot, _
 Left:=280, Top:=145, Width:=40, Height:=80)
 With theWC3
 .Hyperlink.Address = "http://www.contoso.com/page3.htm"
 End With

 Set theWC4 = .AddWebControl(Type:=pbWebControlHotSpot, _
 Left:=200, Top:=105, Width:=80, Height:=40)
 With theWC4
 .Hyperlink.Address = "http://www.contoso.com/page4.htm"
 End With
End With


ShapeRange.AlternativeText Property (Publisher)

 Copy code hover
[image]

ShapeRange.AlternativeText Property (Publisher)
Send feedback

Returns or sets a String representing the text displayed by a Web browser in place of the Shape object while the Shape object is being downloaded or when graphics are turned off. Read/write.

Syntax

expression .AlternativeText

expression A variable that represents a ShapeRange object.

Remarks

The maximum length of the AlternativeText property is 254 characters. Microsoft Publisher returns an error if the text length exceeds this number.

Example

This example sets the alternative text for the selected shape in the active document. This example assumes that you have a publication that the selected shape is a picture of a duck.

Copy code Copy code
Public Sub Alternative_Text()

 ' The picture of a duck must be selected.
 Publisher.ActiveDocument.Selection.ShapeRange _
 .AlternativeText = "This is a mallard duck."

End Sub


PbPrintStyle Enumeration (Publisher)

 Copy code hover
[image]

PbPrintStyle Enumeration (Publisher)
Send feedback

Constants specifying the print style and passed to the PrintOutEx and ExportAsFixedFormat methods.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbPrintStyleBookletSideFold | 5 | Prints the publication in the booklet style with a side fold.
pbPrintStyleBookletTopFold | 6 | Prints the publication in the booklet style with a top fold.
pbPrintStyleDefault | 0 | Prints the publication in the default style.
pbPrintStyleEnvelope | 11 | Prints the publication in the envelope style.
pbPrintStyleHalfFoldSide | 7 | Prints the publication in the half fold on the side style.
pbPrintStyleHalfFoldTop | 8 | Prints the publication in the half fold on the top style.
pbPrintStyleMultipleCopiesPerSheet | 3 | Prints multiple copies of the publication per sheet.
pbPrintStyleMultiplePagesPerSheet | 4 | Prints multiple pages of the publication per sheet.
pbPrintStyleOnePagePerSheet | 1 | Prints one page of the publication on one sheet.
pbPrintStyleQuarterFoldSide | 10 | Prints the publication in the quarter fold side style.
pbPrintStyleQuarterFoldTop | 9 | Prints the publication in the quarter fold top style.
pbPrintStyleTiled | 2 | Prints the publication in the tiled style.


TextFrame Object (Publisher)

 Copy code hover
[image]

TextFrame Object (Publisher)
Send feedback

Represents the text frame in a Shape object. Contains the text in the text frame and the properties that control the margins and orientation of the text frame.

Example

Use the TextFrame property to return the TextFrame object for a shape. The TextRange property returns a TextRange object that represents the range of text inside the specified text frame. The following example adds text to the text frame of shape one in the active publication, and then formats the new text.

Copy code Copy code
Sub AddTextToTextFrame()
 With ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange
 .Text = "My Text"
 With .Font
 .Bold = msoTrue
 .Size = 25
 .Name = "Arial"
 End With
 End With
End Sub
Note Note

Some shapes do not support attached text (lines, freeforms, pictures, and OLE objects, for example). If you attempt to return or set properties that control text in a text frame for those objects, an error occurs.

Use the HasTextFrame property to determine whether the shape has a text frame and use the HasText property to determine whether the text frame contains text, as shown in the following example.

Copy code Copy code
Sub GetTextFromTextFrame()
 Dim shpText As Shape

 For Each shpText In ActiveDocument.Pages(1).Shapes
 If shpText.HasTextFrame = msoTrue Then
 With shpText.TextFrame
 If .HasText Then MsgBox .TextRange.Text
 End With
 End If
 Next
End Sub

Text frames can be linked together so that the text flows from the text frame of one shape into the text frame of another shape. Use the NextLinkedTextFrame and PreviousLinkedTextFrame properties to link text frames. The following example creates a text box (a rectangle with a text frame) and adds some text to it. It then creates another text box and links the two text frames together so that the text flows from the first text frame into the second one.

Copy code Copy code
Sub LinkTextBoxes()
 Dim shpTextBox1 As Shape
 Dim shpTextBox2 As Shape

 Set shpTextBox1 = ActiveDocument.Pages(1).Shapes.AddTextbox _
 (msoTextOrientationHorizontal, 72, 72, 72, 36)
 shpTextBox1.TextFrame.TextRange.Text = _
 "This is some text. This is some more text."

 Set shpTextBox2 = ActiveDocument.Pages(1).Shapes.AddTextbox _
 (msoTextOrientationHorizontal, 72, 144, 72, 36)
 shpTextBox1.TextFrame.NextLinkedTextFrame = shpTextBox2 _
 .TextFrame
End Sub


Hyperlinks Members (Publisher)

 Copy code hover
[image]

Hyperlinks Members (Publisher)
Send feedback

Represents the collection of Hyperlink objects in a text range.

Methods

Name | Description
Add | Adds a new Hyperlink object to the specified Hyperlinks collection and returns the new Hyperlink object.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Item | Returns an individual object from a specified collection. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


ParagraphFormat.StartInNextTextBox Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.StartInNextTextBox Property (Publisher)
Send feedback

Returns or sets an MsoTriState constant that represents whether to always start the selected paragraph in the next linked text box. Read/write.

Syntax

expression .StartInNextTextBox

expression A variable that represents a ParagraphFormat object.

Return Value

MsoTriState

Remarks

The StartInNextTextBox property value can be one of the MsoTriState constants declared in the Microsoft Office type library.

If text is added to the previous text box, causing text to overflow into the text box containing the specified text, the specified text (and any text following it) is moved to the top of the next available text box. If no linked text box is available, the specified text (and any text following it) is placed into the text overflow buffer. It will remain in the buffer until either another linked text box is added to the publication, or the StartInNextTextBox property is changed.

This property corresponds to the Start in next text box control in the Paragraph dialog box.


Options.Parent Property (Publisher)

 Copy code hover
[image]

Options.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents an Options object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


FindReplace Object (Publisher)

 Copy code hover
[image]

FindReplace Object (Publisher)
Send feedback

Represents the criteria for a find operation. The properties and methods of the FindReplace object correspond to the options in the Find and Replace dialog box.

Remarks

When the ReplaceScope property is set to pbReplaceScopeOne or pbReplaceScopeAll, the ReplaceWithText property must be set to avoid the text from being replaced with the default value of an empty String for that property.

Example

Use the Find property to return a FindReplace object. The following example selects the next occurrence of the word "factory".

Copy code Copy code
With ActiveDocument.Find
 .Clear
 .FindText = "factory"
 .Execute
End With

Set the ReplaceScope property to determine the extent of the search. The following example replaces the first occurrence of the name "Visual Basic Scripting Edition" with "VBScript".

Copy code Copy code
With ActiveDocument.Find
 .Clear
 .FindText = "Visual Basic Scripting Edition"
 .ReplaceWithText = "VBScript"
 .ReplaceScope = pbReplaceScopeOne
 .Execute
End With

The following example illustrates how the font attributes of the FoundTextRange can be accessed when ReplaceScope is set to pbReplaceScopeNone.

Copy code Copy code
Dim objFindReplace As FindReplace

Set objFindReplace = ActiveDocument.Find
With objFindReplace
 .Clear
 .FindText = "important"
 .ReplaceScope = pbReplaceScopeNone
 Do While .Execute = True
 If .FoundTextRange.Font.Italic = msoFalse Then
 .FoundTextRange.Font.Italic = msoTrue
 End If
 Loop
End With


MailMerge.EmailMergeEnvelope Property (Publisher)

 Copy code hover
[image]

MailMerge.EmailMergeEnvelope Property (Publisher)
Send feedback

Returns the EmailMergeEnvelope object associated with the parent MailMerge object. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .EmailMergeEnvelope

expression A variable that represents a MailMerge object.

Return Value

EmailMergeEnvelope


Table.Rows Property (Publisher)

 Copy code hover
[image]

Table.Rows Property (Publisher)
Send feedback

Returns a Rows collection that represents all the table rows in a range, selection, or table.

Syntax

expression .Rows

expression A variable that represents a Table object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection .

Example

This example enters the fill for all even-numbered rows and clears the fill for all odd-numbered rows in the specified table. This example assumes the specified shape is a table and not another type of shape.

VBA Copy code Copy code
Sub FillCellsByRow()
 Dim shpTable As Shape
 Dim rowTable As Row
 Dim celTable As Cell

 Set shpTable = ActiveDocument.Pages(1).Shapes _
 .AddTable(NumRows:=5, NumColumns:=5, Left:=100, _
 Top:=100, Width:=100, Height:=12)
 For Each rowTable In shpTable.Table.Rows
 For Each celTable In rowTable.Cells
 If celTable.Row Mod 2 = 0 Then
 celTable.Fill.ForeColor.RGB = RGB _
 (Red:=180, Green:=180, Blue:=180)
 Else
 celTable.Fill.ForeColor.RGB = RGB _
 (Red:=255, Green:=255, Blue:=255)
 End If
 Next celTable
 Next rowTable
End Sub


TextRange.InsertMailMergeField Method (Publisher)

 Copy code hover
[image]

TextRange.InsertMailMergeField Method (Publisher)
Send feedback

Returns a TextRange object that represents a text data field for a mail merge or catalog merge.

Syntax

expression .InsertMailMergeField(varIndex)

expression A variable that represents a TextRange object.

Parameters

Name | Required/Optional | Data Type | Description
varIndex | Required | Variant | The name or index of the data field in the datasource.

Return Value

TextRange

Remarks

For a publication's catalog merge area to contain text data fields, it must first contain at least one text box to contain the text data fields.

Example

This example inserts a LastName field at the cursor position. This example assumes that the active publication is a mail merge publication and that the cursor position is somewhere inside a text box.

Copy code Copy code
Sub InsertMergeField()
 Selection.TextRange.InsertMailMergeField varIndex:="LastName"
End Sub

This example adds a text box to the specified publication's catalog merge area, and then inserts a text data field into the text box. This example assumes that the specified publication is connected to a data source, and that it contains a catalog merge area.

Copy code Copy code
Set pbTextBox1 = ThisDocument.Pages(1).Shapes.AddTextbox(1, 100, 100, 175, 25)
pbTextBox1.AddToCatalogMergeArea

With pbTextBox1.TextFrame.TextRange
 .Text = "List Price: "
 .InsertMailMergeField "List Price"
End With


DropCap.LinesUp Property (Publisher)

 Copy code hover
[image]

DropCap.LinesUp Property (Publisher)
Send feedback

Returns or sets a Long that represents the number of lines an initial dropped capital letter is raised above the line of text on which it exists. Read/write.

Syntax

expression .LinesUp

expression A variable that represents a DropCap object.

Return Value

Long

Example

This example creates a custom dropped capital letter that is five lines high and raises it two lines above the line on which it exists.

Copy code Copy code
Sub RaisedDropCap()
 Dim intCount As Integer
 With ActiveDocument.Pages(1).Shapes _
 .AddTextbox(Orientation:=pbTextOrientationHorizontal, _
 Left:=100, Top:=100, Width:=100, Height:=100) _
 .TextFrame.TextRange
 For intCount = 1 To 10
 .InsertAfter NewText:="This is a test. "
 Next intCount
 With .DropCap
 .Size = 5
 .LinesUp = 2
 End With
 End With
End Sub


ThreeDFormat.Parent Property (Publisher)

 Copy code hover
[image]

ThreeDFormat.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a ThreeDFormat object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


CellRange Members (Publisher)

 Copy code hover
[image]

CellRange Members (Publisher)
Send feedback

A collection of Cell objects in a table column or row. The CellRange collection represents all the cells in the specified column or row.

Methods

Name | Description
Item | Returns an individual Cell object in the specified CellRange collection.
Merge | Merges the specified table cells with one another. The result is a single table cell.
Select | Selects the specified object.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Column | Returns a Long that represents the table column containing the specified cell. Read-only.
Count | Returns a Long that represents the number of items in the specified collection.
Height | Returns a Long that represent the height (in cells) of a table, range of cells, or page. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Row | Returns a Long that represents the row number containing the specified cell. Read-only.
Width | Returns a Long that represent the width (in cells) of a table, range of cells, or page. Read-only.


TabStops Members (Publisher)

 Copy code hover
[image]

TabStops Members (Publisher)
Send feedback

A collection of TabStop objects that represent the custom and default tabs for a paragraph or group of paragraphs.

Methods

Name | Description
Add | Adds a new tab stop to the specified TabStops collection.
ClearAll | Clears all the custom tab stops from the specified paragraphs.
Item | Returns an individual object in a specified collection.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Cell.Split Method (Publisher)

 Copy code hover
[image]

Cell.Split Method (Publisher)
Send feedback

Splits a merged table cell back into its constituent cells. Returns a CellRange object representing the constituent cells.

Syntax

expression .Split

expression A variable that represents a Cell object.

Return Value

CellRange

Remarks

If the specified cell is not a merged cell resulting from using the Merge method, an error occurs.

Example

The following example splits the first cell in the table in shape one on page one of the active publication into its constituent cells. Shape one must contain a table, the first cell of which is a merged cell, in order for this example to work.

VBA Copy code Copy code
Dim cllMerged As Cell

Set cllMerged = ActiveDocument.Pages(1).Shapes(1).Table.Cells.Item(1)

cllMerged.Split


PbRulerGuideType Enumeration (Publisher)

 Copy code hover
[image]

PbRulerGuideType Enumeration (Publisher)
Send feedback

Represents the ruler guide type.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbRulerGuideTypeHorizontal | 2 | Horizontal ruler
pbRulerGuideTypeVertical | 1 | Vertical ruler


Printer.DriverType Property (Publisher)

 Copy code hover
[image]

Printer.DriverType Property (Publisher)
Send feedback

Specifies the type of driver supported by the printer. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .DriverType

expression A variable that represents a Printer object.

Return Value

PbDriverType

Remarks

Possible values for the DriverType property are declared in the PbDriverType enumeration and shown in the following table.

Constant | Value | Description
pbDriverTypeNonPostScript | 1 | Non PostScript
pbDriverTypePostScript1 | 2 | PostScript 1
pbDriverTypePostScript2 | 3 | PostScript 2
pbDriverTypePostScript3 | 4 | PostScript 3


FindReplace.Parent Property (Publisher)

 Copy code hover
[image]

FindReplace.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a FindReplace object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Application.ActiveWindow Property (Publisher)

 Copy code hover
[image]

Application.ActiveWindow Property (Publisher)
See also Send feedback

Returns a Window object that represents the window with the focus. Because Microsoft Publisher only has one window, there is only one Window object to return.

Syntax

expression .ActiveWindow

expression A variable that represents an Application object.

Example

This example displays the active window's caption.

Copy code Copy code
Sub CurrentCaption()

 MsgBox ActiveDocument.ActiveWindow.Caption

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Document.FullName Property (Publisher)

 Copy code hover
[image]

Document.FullName Property (Publisher)
Send feedback

Returns a String representing the full file name of the saved active publication, including its path and file name. Read-only.

Syntax

expression .FullName

expression A variable that represents a Document object.

Return Value

String

Remarks

The FullName property can be used to return both path and file name as returned by the Path and Name properties.

Example

The following example demonstrates the differences between the Path, Name, and FullName properties. This example is best illustrated if the publication is saved in a folder other than the default.

Copy code Copy code
Sub PathNames()

 Dim strPath As String
 Dim strName As String
 Dim strFullName As String

 strPath = Application.ActiveDocument.Path
 strName = Application.ActiveDocument.Name
 strFullName = Application.ActiveDocument.FullName

 ' Note the file name & path differences
 ' while executing.
 MsgBox "The path is: " & strPath
 MsgBox "The file name is: " & strName
 MsgBox "The path & file name are: " & strFullName

End Sub


Wizard.Application Property (Publisher)

 Copy code hover
[image]

Wizard.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a Wizard object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


TextStyle Object (Publisher)

 Copy code hover
[image]

TextStyle Object (Publisher)
Send feedback

Represents a single built-in or user-defined style. The TextStyle object includes style attributes (font, font style, paragraph spacing, and so on) as properties of the TextStyle object. The TextStyle object is a member of the TextStyles collection. The TextStyles collection includes all the styles in the specified document.

Example

Use TextStyles(index), where index is the text style number or name, to return a single TextStyle object. You must exactly match the spelling and spacing of the style name, but not necessarily its capitalization.

The following example displays the style name and base style of the first style in the TextStyles collection.

Copy code Copy code
Sub BaseStyleName()
 With ActiveDocument.TextStyles(1)
 MsgBox "Style name= " & .Name _
 & vbCr & "Base style= " & .BaseStyle
 End With
End Sub

Use the Add method to create a new style. To apply a style to a range, paragraph, or multiple paragraphs, set the TextStyle property to a user-defined or built-in style name. The following example creates a new style and applies it to the paragraph at the cursor position.

Copy code Copy code
Sub ApplyTextStyle()
 Dim styNew As TextStyle
 Dim fntStyle As Font

 'Create a new style
 Set styNew = ActiveDocument.TextStyles.Add(StyleName:="NewStyle")
 Set fntStyle = styNew.Font

 'Format the Font object
 With fntStyle
 .Name = "Tahoma"
 .Size = 20
 .Bold = msoTrue
 End With

 'Apply the Font object formatting to the new style
 styNew.Font = fntStyle

 'Apply the new style to the selected paragraph
 Selection.TextRange.ParagraphFormat.TextStyle = "NewStyle"
End Sub


PhoneticGuide Object (Publisher)

 Copy code hover
[image]

PhoneticGuide Object (Publisher)
Send feedback

Represents base text with supplementary text appearing above it as a guide to pronunciation.

Example

Use the PhoneticGuide property of a Field object to return an existing PhoneticGuide object. Use the AddPhoneticGuide method of a Fields collection to create a new PhoneticGuide object.

The following example adds a new PhoneticGuide object to the active publication.

Copy code Copy code
Selection.TextRange.Fields.AddPhoneticGuide _
 Range:=Selection.TextRange, Text:="ver-E nIs", _
 Alignment:=pbPhoneticGuideAlignmentCenter, _
 Raise:=11, FontSize:=7


WebHiddenFields.Count Property (Publisher)

 Copy code hover
[image]

WebHiddenFields.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a WebHiddenFields object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


Shapes.Item Method (Publisher)

 Copy code hover
[image]

Shapes.Item Method (Publisher)
Send feedback

Returns an individual object in a specified collection.

Syntax

expression .Item(Index)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The number or name of the field or list box item to return.

Return Value

Shape

Example

This example returns the first shape inside a grouped shape.

VBA Copy code Copy code
Dim shpTemp As Shape

Set shpTemp = ActiveDocument.Pages(Index:=1) _
 .Shapes(1).GroupItems.Item(Index:=1)


ShapeNode Members (Publisher)

 Copy code hover
[image]

ShapeNode Members (Publisher)
Send feedback

Represents the geometry and the geometry-editing properties of the nodes in a user-defined freeform. Nodes include the vertices between the segments of the freeform and the control points for curved segments. The ShapeNode object is a member of the ShapeNodes collection. The ShapeNodes collection contains all the nodes in a freeform.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
EditingType | If the specified node is a vertex, this property returns an MsoEditingType constant indicating how changes made to the node affect the two segments connected to the node. If the node is a control point for a curved segment, this property returns the editing type of the adjacent vertex. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Points | Gets the x- and y- coordinates of the shape node. Read-only.
SegmentType | Returns an MsoSegmentType constant that indicates whether the segment associated with the specified node is straight or curved. Read-only.


ReaderSpread.Pages Property (Publisher)

 Copy code hover
[image]

ReaderSpread.Pages Property (Publisher)
Send feedback

Returns a Page object representing one of the pages that compose the specified reader spread.

Syntax

expression .Pages(Index)

expression A variable that represents a ReaderSpread object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The page from the reader spread to return. Can be either 1 or 2.

Remarks

A reader spread will consist of only one or two pages, which is why the valid values for the Index argument are 1 or 2.

Example

The following example checks the reader spread of the fifth page in the active publication to see if it contains more than one page. If it does, the example reports the page number of the second page in the spread.

VBA Copy code Copy code
Dim pageTemp As Page

With ActiveDocument.Pages(5).ReaderSpread
 If .PageCount > 1 Then
 Set pageTemp = .Pages(Index:=2)
 MsgBox "The page number of the second page " _
 & "in the spread is " & pageTemp.PageNumber
 Else
 MsgBox "The spread has only one page."
 End If
End With


Shape.TextEffect Property (Publisher)

 Copy code hover
[image]

Shape.TextEffect Property (Publisher)
Send feedback

Returns a TextEffectFormat object that represents the text formatting properties of a WordArt object.

Syntax

expression .TextEffect

expression A variable that represents a Shape object.

Example

This example adds a WordArt object to the active publication and formats and inserts additional into it.

Copy code Copy code
Sub AddFormatNewWordArt()
 With ActiveDocument.Pages(1).Shapes.AddTextEffect( _
 PresetTextEffect:=msoTextEffect1, Text:="Test", _
 FontName:="Snap ITC", FontSize:=30, FontBold:=msoTrue, _
 FontItalic:=msoFalse, Left:=150, Top:=130)
 .Rotation = 90
 With .TextEffect
 .RotatedChars = msoTrue
 .Text = "This is a " & .Text
 End With
 .Width = 250
 End With
End Sub


TabStop.Application Property (Publisher)

 Copy code hover
[image]

TabStop.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a TabStop object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


PageSetup.VerticalGap Property (Publisher)

 Copy code hover
[image]

PageSetup.VerticalGap Property (Publisher)
Send feedback

Returns a Variant that represents the distance (in points) between the bottom edge of one publication page and top edge of the publication page below it when more than one publication page is printed on a single printer page. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .VerticalGap

expression A variable that represents a PageSetup object.

Return Value

Variant

Remarks

You can use the VerticalGap property when you want to print multiple pages on a single sheet of printer paper. If the page size, including the values for the VerticalGap and HorizontalGap properties, is greater than half the paper size, Microsoft Publisher displays an error.


ThreeDFormat.ExtrusionColor Property (Publisher)

 Copy code hover
[image]

ThreeDFormat.ExtrusionColor Property (Publisher)
Send feedback

Returns a ColorFormat object representing the color of the shape's extrusion.

Syntax

expression .ExtrusionColor

expression A variable that represents an ThreeDFormat object.

Return Value

ColorFormat

Example

This example adds an oval to the active publication, and then specifies that the oval be extruded to a depth of 50 points and that the extrusion be purple.

Copy code Copy code
Dim shpNew As Shape

' Set a reference to a new oval.
Set shpNew = ActiveDocument.Pages(1).Shapes _
 .AddShape(Type:=msoShapeOval, _
 Left:=90, Top:=90, Width:=90, Height:=40)

' Format the 3-D properties of the oval.
With shpNew.ThreeD
 .Visible = True
 .Depth = 50
 .ExtrusionColor.RGB = RGB(255, 100, 255)
End With


PbPictureInsertAs Enumeration (Publisher)

 Copy code hover
[image]

PbPictureInsertAs Enumeration (Publisher)
Send feedback

The manner in which you want the picture file inserted into the document: linked or embedded.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbPictureInsertAsEmbedded | 1 | Embed all images.
pbPictureInsertAsLinked | 2 | Images can either be linked externally or internally.
pbPictureInsertAsOriginalState | 3 | Default. Image is inserted in its original state.


Field.Result Property (Publisher)

 Copy code hover
[image]

Field.Result Property (Publisher)
Send feedback

Returns a String that represents the result of the specified field. Read-only.

Syntax

expression .Result

expression A variable that represents a Field object.

Return Value

String

Example

This example applies bold formatting to the first field in the selection. This example assumes that either text or a shape with text is selected in the active publication.

VBA Copy code Copy code
Sub GetFieldResults()
 If Selection.TextRange.Fields.Count > 0 Then
 MsgBox "The result of the first field is " & _
 Selection.TextRange.Fields(1).Result & "."
 End If
End Sub


DropCap.Application Property (Publisher)

 Copy code hover
[image]

DropCap.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a DropCap object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


TabStops.Parent Property (Publisher)

 Copy code hover
[image]

TabStops.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a TabStops object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


WebOptions.Application Property (Publisher)

 Copy code hover
[image]

WebOptions.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a WebOptions object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


MailMerge.ExportRecipientList Method (Publisher)

 Copy code hover
[image]

MailMerge.ExportRecipientList Method (Publisher)
Send feedback

Exports the list of mail-merge recipients to a Microsoft Office Access (.mdb) file or to a comma-delimited text (.csv) file.

Version Information

Version Added: Publisher 2007

Syntax

expression .ExportRecipientList(Filename, FileType, IncludedOnly)

expression A variable that represents a MailMerge object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | The name of the file that will contain the list of recipients.
FileType | Optional | PbRecipientListFileType | The type of file to save. See Remarks for possible values.
IncludedOnly | Optional | Boolean | Whether to restrict entries in the recipient list to specific recipients.

Remarks

Possible values for the FileType parameter include the following constants from the PbRecipientListFileType enumeration:

Constant | Value | Description
pbAsCsvFile | 1 | Save as comma-delimited CSV file.
pbAsMdbFile | 0 | Save as Microsoft Office Access MDB file.

The ExportRecipientList method corresponds to the Export recipient list to new file command in the E-mail Merge and Mail Merge task panes in the Microsoft Publisher user interface.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the ExportRecipientList method to export the list of mail-merge recipients to an Access database file. Before running this macro, ensure that the active document is connected to a data source. If the active document is not already connected to a data source, you can use the MailMerge.OpenDataSource method to make the connection.

Also, before running the code, replace username in the folder path to the saved file with the name of a valid user on your computer, or replace the folder path and file name with a path and file name of your choice.

Note that the folder path used in this example is typical of folder paths in Microsoft Windows Vista. You must have permission to save files in the folder you designate.

VBA Copy code Copy code
Public Sub ExportRecipientList_Example()

 Dim pubMailMerge As Publisher.MailMerge

 Set pubMailMerge = ThisDocument.MailMerge
 pubMailMerge.ExportRecipientList "C:\Users\username\Documents\My Data Sources\MyAddressList", pbAsMdbFile, True

End Sub


FillFormat.TextureName Property (Publisher)

 Copy code hover
[image]

FillFormat.TextureName Property (Publisher)
Send feedback

Returns a String indicating the name of the custom texture file for the specified fill. Read-only.

Syntax

expression .TextureName

expression A variable that represents a FillFormat object.

Return Value

String

Remarks

Use the UserTextured method to set the texture file for the fill.

Example

This example adds an oval to the active publication. If shape one on the active publication has a fill with a user-defined texture, the new oval will have the same fill as shape one. If shape one has any other type of fill, the new oval will have a green marble fill.

VBA Copy code Copy code
Dim ffNew As FillFormat

With ActiveDocument.Pages(1).Shapes
 Set ffNew = .AddShape(Type:=msoShapeOval, _
 Left:=0, Top:=0, Width:=200, Height:=90).Fill

 With .Item(1).Fill
 If .Type = msoFillTextured And _
 .TextureType = msoTextureUserDefined Then
 ffNew.UserTextured _
 TextureFile:=.TextureName
 Else
 ffNew.PresetTextured _
 PresetTexture:=msoTextureGreenMarble
 End If
 End With
End With


ShapeRange.OLEFormat Property (Publisher)

 Copy code hover
[image]

ShapeRange.OLEFormat Property (Publisher)
Send feedback

Returns an OLEFormat object that contains OLE formatting properties for the specified shape. Applies to Shape or ShapeRange objects that represent OLE objects.

Syntax

expression .OLEFormat

expression A variable that represents a ShapeRange object.

Example

This example loops through all the shapes on the first page of the active document and automatically updates all linked Excel worksheets.

Copy code Copy code
Sub UpdateLinkedExcelSpreadsheets()
 Dim shp As Shape
 For Each shp In ActiveDocument.Pages(1).Shapes
 If shp.Type = msoLinkedOLEObject Then
 If shp.OLEFormat.ProgId = "Excel.Sheet" Then
 shp.LinkFormat.Update
 End If
 End If
 Next shp
End Sub


ShapeRange.Rotation Property (Publisher)

 Copy code hover
[image]

ShapeRange.Rotation Property (Publisher)
Send feedback

Returns or sets a Single that represents the number of degrees the specified shape is rotated around the z-axis. A positive value indicates clockwise rotation; a negative value indicates counterclockwise rotation. Read/write.

Syntax

expression .Rotation

expression A variable that represents a ShapeRange object.

Remarks

To set the rotation of a three-dimensional shape around the x-axis or the y-axis, use the RotationX property or the RotationY property of the ThreeDFormat object.

Example

This example matches the rotation of all shapes on the first page of the active publication to the rotation of the first shape. This example assumes there are at least two shapes on the first page of the active publication.

Copy code Copy code
Sub SetShapeRotation()
 Dim sngRotation As Single
 Dim intCount As Integer
 With ActiveDocument.Pages(1).Shapes
 sngRotation = .Item(1).Rotation
 For intCount = 1 To .Count
 .Item(intCount).Rotation = sngRotation
 Next intCount
 End With
End Sub


WebOptionButton.Parent Property (Publisher)

 Copy code hover
[image]

WebOptionButton.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a WebOptionButton object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Document.DefaultTabStop Property (Publisher)

 Copy code hover
[image]

Document.DefaultTabStop Property (Publisher)
Send feedback

Returns or sets a Variant corresponding to the default tab stop for all text in the active publication. Valid range is 1 to 1584 points (0.014" to 22"). Once set, numeric values are considered to be in points. String values may be in any unit supported by Microsoft Publisher. Point values are always returned. If values are outside the valid range, an error is returned. Read/write.

Syntax

expression .DefaultTabStop

expression A variable that represents a Document object.

Return Value

Variant

Remarks

Use the InchesToPoints method to convert inches to points.

Example

This example sets the DefaultTabStop property to 72 points for all text in the active publication.

Copy code Copy code
Sub SetTab()
 Application.ActiveDocument.DefaultTabStop = 72
End Sub


Plate.InkName Property (Publisher)

 Copy code hover
[image]

Plate.InkName Property (Publisher)
Send feedback

Returns a PbInkName constant that represents the name of the ink to be printed using this plate. Read-only.

Syntax

expression .InkName

expression A variable that represents a Plate object.

Remarks

The InkName property value can be one of the PbInkName constants declared in the Microsoft Publisher type library.

Use the FindPlateByInkName method of the PrintablePlates collection to return a specific plate by referencing its ink name.

Example

The following example returns a list of the printable plates currently in the collection for the active publication. The example assumes that separations have been specified as the active publication's print mode.

VBA Copy code Copy code
Sub ListPrintablePlates()
 Dim pplTemp As PrintablePlates
 Dim pplLoop As PrintablePlate

 Set pplTemp = ActiveDocument.AdvancedPrintOptions.PrintablePlates
 Debug.Print "There are " & pplTemp.Count & " printable plates in this publication."

 For Each pplLoop In pplTemp
 With pplLoop
 Debug.Print "Printable Plate Name: " & .Name
 Debug.Print "Index: " & .Index
 Debug.Print "Ink Name: " & .InkName
 Debug.Print "Plate Angle: " & .Angle
 Debug.Print "Plate Frequency: " & .Frequency
 Debug.Print "Print Plate?: " & .PrintPlate
 End With
 Next pplLoop
End Sub


ShapeRange.Ungroup Method (Publisher)

 Copy code hover
[image]

ShapeRange.Ungroup Method (Publisher)
Send feedback

Ungroups the specified group of shapes or any groups of shapes in the specified shape range. If the specified shape is a picture or OLE object, Microsoft Publisher will break it apart and convert it to an ungrouped set of shapes. (For example, an embedded Microsoft Excel spreadsheet is converted into lines and text boxes.) Returns the ungrouped shapes as a single ShapeRange object.

Syntax

expression .Ungroup

expression A variable that represents a ShapeRange object.

Return Value

ShapeRange

Remarks

Using this method on an inline shape or a shape that isn't a group, picture, or OLE object generates an error. Also, an error occurs if the picture is a bitmap, JPEG, GIF, or PNG (Portable Network Graphics) file.

Because a group of shapes is treated as a single object, grouping and ungrouping shapes changes the number of items in the Shapes collection and changes the index numbers of items that come after the affected items in the collection. Also, newly ungrouped shapes are added to the Shapes collection on the current page (or pages) or scratch area. As a result, they may shift from one collection to another.

Example

This example ungroups any grouped shapes on the first page of the active publication.

VBA Copy code Copy code
Dim shpLoop As Shape

For Each shpLoop In ActiveDocument.Pages(1).Shapes
 If shpLoop.Type = pbGroup Then shpLoop.Ungroup
Next shpLoop


Document.PublicationType Property (Publisher)

 Copy code hover
[image]

Document.PublicationType Property (Publisher)
Send feedback

Returns a PbPublicationType constant that represents the type of the specified publication. Read-only.

Syntax

expression .PublicationType

expression A variable that represents a Document object.

Return Value

PbPublicationType

Remarks

The PublicationType property value can be one of these PbPublicationType constants.

pbTypePrint

pbTypeWeb

Example

The following example determines if the active publication is a print publication. If it is, the publication is converted to a Web publication.

VBA Copy code Copy code
Sub ChangePublicationType()
 With ActiveDocument
 If .PublicationType = pbTypePrint Then
 .ConvertPublicationType (pbTypeWeb)
 End If
 End With
End Sub


PbLinkedFileStatus Enumeration (Publisher)

 Copy code hover
[image]

PbLinkedFileStatus Enumeration (Publisher)
Send feedback

Indicates the status of the file linked to the specified picture.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbLinkedFileMissing | 2 | The file can no longer be found at the specified path.
pbLinkedFileModified | 3 | The linked file has been modified since it was linked to the picture.
pbLinkedFileOK | 1 | The file resides at the specified path, and has not been modified since it was linked to the picture.


ColorFormat.Application Property (Publisher)

 Copy code hover
[image]

ColorFormat.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a ColorFormat object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Shape.Left Property (Publisher)

 Copy code hover
[image]

Shape.Left Property (Publisher)
Send feedback

Returns or sets a Variant indicating the distance from the left edge of the page to the leftmost edge of the specified shape. Numeric values are in points; all other values are in any measurement supported by Publisher (for example, "2.5 in"). Read/write.

Syntax

expression .Left

expression A variable that represents a Shape object.

Example

This example sets the horizontal position of the first shape in the active publication to 1 inch from the left edge of the page.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes(1)
 .Left = InchesToPoints(1)
End With


TextStyle.Description Property (Publisher)

 Copy code hover
[image]

TextStyle.Description Property (Publisher)
Send feedback

Returns a String that represents the description of the specified style. For example, a typical description for the Normal style might be "(Default) Times New Roman, (Asian) MS Mincho, 10 pt, Main (Black), Kerning 14 pt, Left, Line spacing 1 sp." Read-only.

Syntax

expression .Description

expression A variable that represents a TextStyle object.

Example

This example displays the description for the Normal style.

VBA Copy code Copy code
Sub ShowStyleDescription()
 MsgBox "The Normal style has the following formatting attributes: " & _
 vbLf & ActiveDocument.TextStyles("Normal").Description
End Sub


Shape.ConnectorFormat Property (Publisher)

 Copy code hover
[image]

Shape.ConnectorFormat Property (Publisher)
Send feedback

Returns a ConnectorFormat object that contains connector formatting properties. Applies to Shape or ShapeRange objects that represent connectors. Read-only.

Syntax

expression .ConnectorFormat

expression A variable that represents a Shape object.

Example

This example adds two rectangles to the first page in the active publication and connects them with a curved connector.

Copy code Copy code
Dim shpRect1 As Shape
Dim shpRect2 As Shape

With ActiveDocument.Pages(1).Shapes

 ' Add two new rectangles.
 Set shpRect1 = .AddShape(Type:=msoShapeRectangle, _
 Left:=100, Top:=50, Width:=200, Height:=100)
 Set shpRect2 = .AddShape(Type:=msoShapeRectangle, _
 Left:=300, Top:=300, Width:=200, Height:=100)

 ' Add a new curved connector.
 With .AddConnector(Type:=msoConnectorCurve, _
 BeginX:=0, BeginY:=0, EndX:=100, EndY:=100) _
 .ConnectorFormat

 ' Connect the new connector to the two rectangles.
 .BeginConnect ConnectedShape:=shpRect1, ConnectionSite:=1
 .EndConnect ConnectedShape:=shpRect2, ConnectionSite:=1

 ' Reroute the connector to create the shortest path.
 .Parent.RerouteConnections
 End With

End With


GlowFormat Members (Publisher)

 Copy code hover
[image]

GlowFormat Members (Publisher)
Send feedback

Represents the glow formatting for a shape or a range of shapes.

Properties

Name | Description
Color | Returns a ColorFormat object that represents the color for a glow effect. Read-only.
Radius | Returns or sets a Single that represents the length of the radius for a glow effect. Read/write.
Transparency | Returns or sets the degree of transparency for the glow effect as a value between 0.0 (opaque) and 1.0 (clear). Read/write Single.
Visible | True if the specified object or the formatting applied to it is visible. Read/write MsoTriState.


Shape.Tags Property (Publisher)

 Copy code hover
[image]

Shape.Tags Property (Publisher)
Send feedback

Returns a Tags collection representing tags or custom properties applied to a shape, shape range, page, or publication.

Syntax

expression .Tags

expression A variable that represents a Shape object.

Example

This example adds a tag to each oval shape on the first page of the active publication.

Copy code Copy code
Dim shp As Shape
Dim tagsAll As Tags
Dim tagLoop As Tag
Dim blnTag As Boolean

With ActiveDocument.Pages(1)
 For Each shp In .Shapes
 If shp.AutoShapeType = msoShapeOval Then
 Set tagsAll = shp.Tags
 blnTag = False

 For Each tagLoop In tagsAll
 If tagLoop.Name = "Shape" Then
 blnTag = True
 Exit For
 End If
 Next tagLoop

 If blnTag = False Then
 tagsAll.Add Name:="Shape", Value:="Oval"
 End If
 End If
 Next shp
End With


PbFixedFormatType Enumeration (Publisher)

 Copy code hover
[image]

PbFixedFormatType Enumeration (Publisher)
Send feedback

Constants passed to the ExportAsFixedFormat method that specify the different file formats in which you can save fixed-format publications, PDF or XPS.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbFixedFormatTypePDF | 2 | PDF format
pbFixedFormatTypeXPS | 1 | XPS format


Shape.Name Property (Publisher)

 Copy code hover
[image]

Shape.Name Property (Publisher)
Send feedback

Returns or sets a String value indicating the name of the specified object. Read/write.

Syntax

expression .Name

expression A variable that represents a Shape object.

Remarks

You can use an object's name in conjunction with the Item method or Item property to return a reference to the object if the Item method or property for the collection that contains the object takes a Variant argument. For example, if the value of the Name property for a shape is Rectangle 2, then .Shapes("Rectangle 2") will return a reference to that shape.

The Name property is the default property for the BorderArt, BorderArtFormat, and Label objects.


Document.BeginCustomUndoAction Method (Publisher)

 Copy code hover
[image]

Document.BeginCustomUndoAction Method (Publisher)
Send feedback

Specifies the starting point and label (textual description) of a group of actions that are wrapped to create a single undo action. The EndCustomUndoAction method is used to specify the endpoint of the actions used to create the single undo action. The wrapped group of actions can be undone with a single undo.

Syntax

expression .BeginCustomUndoAction(ActionName)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
ActionName | Required | String | The label that corresponds to the single undo action. This label appears when you click the arrow beside the Undo button on the Standard toolbar.

Remarks

The following methods of the Document object are unavailable within a custom undo action. A run-time error is returned if any of these methods are called within a custom undo action:

  • Document.Close

  • Document.MailMerge.DataSource.Close

  • Document.PrintOut

  • Document.Redo

  • Document.Save

  • Document.SaveAs

  • Document.Undo

  • Document.UndoClear

  • Document.UpdateOLEObjects

The BeginCustomUndoAction method must be called before the EndCustomUndoAction method is called. A run-time error is returned if EndCustomUndoAction is called before BeginCustomUndoAction.

Nesting a custom undo action within another custom undo action is allowed, but the nested custom undo action has no effect. Only the outermost custom undo action is active.

Example

The following example contains two custom undo actions. The first one is created on the first page of the active publication. The BeginCustomUndoAction method is used to specify the point at which the custom undo action should begin. Six individual actions are performed, and then they are wrapped into one action with the call to EndCustomUndoAction.

The text in the text frame that was created within the first custom undo action is then tested to determine whether the font is Verdana. If not, the Undo method is called with UndoActionsAvailable passed as a parameter. In this case there is only one undo action available. So, the call to Undo Method will undo only one action, but this one action has wrapped six actions into one.

A second undo action is then created, and it could also be undone later with a single undo operation.

Copy code Copy code
Dim thePage As page
Dim theShape As Shape
Dim theDoc As Publisher.Document

Set theDoc = ActiveDocument
Set thePage = theDoc.Pages(1)

With theDoc
 ' The following six actions are wrapped to create one
 ' custom undo action named "Add Rectangle and Courier Text".
 .BeginCustomUndoAction ("Add Rectangle and Courier Text")
 With thePage
 Set theShape = .Shapes.AddShape(msoShapeRectangle, _
 75, 75, 190, 30)
 With theShape.TextFrame.TextRange
 .Font.Size = 14
 .Font.Bold = msoTrue
 .Font.Name = "Courier"
 .Text = "This font is Courier."
 End With
 End With
 .EndCustomUndoAction

 If Not thePage.Shapes(1).TextFrame.TextRange.Font.Name = "Verdana" Then
 ' This call to Undo will undo all actions that are available.
 ' In this case, there is only one action that can be undone.
 .Undo (.UndoActionsAvailable)
 ' A new custom undo action is created with a name of
 ' "Add Balloon and Verdana Text".
 .BeginCustomUndoAction ("Add Balloon and Verdana Text")
 With thePage
 Set theShape = .Shapes.AddShape(msoShapeBalloon, _
 75, 75, 190, 30)
 With theShape.TextFrame.TextRange
 .Font.Size = 11
 .Font.Name = "Verdana"
 .Text = "This font is Verdana."
 End With
 End With
 .EndCustomUndoAction
 End If
End With


BorderArts Properties (Publisher)

 Copy code hover
[image]

BorderArts Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


BorderArtFormat.Application Property (Publisher)

 Copy code hover
[image]

BorderArtFormat.Application Property (Publisher)
See also Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a BorderArtFormat object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next

See also

Concepts

BorderArtFormat Object

Other resources

BorderArtFormat Object Members


HeaderFooter Methods (Publisher)

 Copy code hover
[image]

HeaderFooter Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified object.


Options.DisplayStatusBar Property (Publisher)

 Copy code hover
[image]

Options.DisplayStatusBar Property (Publisher)
Send feedback

True for Microsoft Publisher to show the status bar at the bottom of the Publisher window. Read/write Boolean.

Syntax

expression .DisplayStatusBar

expression A variable that represents a Options object.

Return Value

Boolean

Example

This example hides the status bar from view.

Copy code Copy code
Sub HideStatusBar()
 Options.DisplayStatusBar = False
End Sub


CellRange.Width Property (Publisher)

 Copy code hover
[image]

CellRange.Width Property (Publisher)
Send feedback

Returns a Long that represent the width (in cells) of a table, range of cells, or page. Read-only.

Syntax

expression .Width

expression A variable that represents a CellRange object.


WizardValue Properties (Publisher)

 Copy code hover
[image]

WizardValue Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
ID | Returns a Long that represents the type of a shape, range of shapes, or property, type, or value of a wizard. Read-only.
Name | Returns a String value indicating the name of the specified object. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Window Object (Publisher)

 Copy code hover
[image]

Window Object (Publisher)
Send feedback

Represents a window. Many publication characteristics, such as scroll bars and rulers, are actually properties of the window.

Example

Use the ActiveWindow property to return a Window object. The following example maximizes the active window.

Copy code Copy code
Sub MaximizeWindow
 ActiveWindow.WindowState = pbWindowStateMaximize
End Sub

Use the Caption property to return the file and application names of the active window. The following example displays a message with the file name and Microsoft Publisher application name.

Copy code Copy code
Sub ShowFileApNames
 MsgBox Windows(1).Caption
End Sub


FillFormat Members (Publisher)

 Copy code hover
[image]

FillFormat Members (Publisher)
Send feedback

Represents fill formatting for a shape. A shape can have a solid, gradient, texture, pattern, picture, or semitransparent fill.

Methods

Name | Description
OneColorGradient | Sets the specified fill to a one-color gradient.
Patterned | Sets the specified fill to a pattern.
PresetGradient | Sets the specified fill to a preset gradient.
PresetTextured | Sets the specified fill to a preset texture.
Solid | Sets the specified fill to a uniform color. Use this method to convert a gradient, textured, patterned, or background fill back to a solid fill.
TwoColorGradient | Sets the specified fill to a two-color gradient. The two fill colors are specified by the ForeColor and BackColor properties.
UserPicture | Fills the specified shape with one large image.
UserTextured | Fills the specified shape with small tiles of an image.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
BackColor | Returns or sets a ColorFormat object representing the background color for the specified fill or patterned line. .
ForeColor | Returns or sets a ColorFormat object representing the foreground color for the fill, line, or shadow. Read/write.
GradientAngle | Returns or sets the angle of the gradient fill for the specified fill format. Read/write.
GradientColorType | Returns an MsoGradientColorType constant indicating the gradient color type for the specified fill. Read-only.
GradientDegree | Returns a Single indicating how dark or light a one-color gradient fill is. A value of 0 (zero) means that black is mixed in with the shape's foreground color to form the gradient; a value of 1 means that white is mixed in; and values between 0 and 1 mean that a darker or lighter shade of the foreground color is mixed in. Read-only.
GradientStyle | Returns an MsoGradientStyle constant indicating the gradient style for the specified fill. Read-only.
GradientVariant | Returns a Long indicating the gradient variant for the specified fill. Generally, values are integers from 1 to 4 for most gradient fills. If the gradient style is msoGradientFromTitle or msoGradientFromCenter, this property returns either 1 or 2. The values for this property correspond to the gradient variants (numbered from left to right and from top to bottom) on the Gradient tab in the Fill Effects dialog box. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Pattern | Returns an MsoPatternType constant that represents the pattern applied to the specified fill or line.
PresetGradientType | Returns an MsoPresetGradientType constant that represents the preset gradient type for the specified fill. Read-only.
PresetTexture | Returns an MsoPresetTexture constant that represents the preset texture for the specified fill. Read-only.
RotateWithObject | Returns or sets whether the fill rotates with the specified shape. Read/write.
TextureAlignment | Returns or sets the alignment (the origin of the coordinate grid) for the tiling of the texture fill. Read/write.
TextureHorizontalScale | Returns or sets a Single that specifies the horizontal scaling factor for the texture fill. Read/write.
TextureName | Returns a String indicating the name of the custom texture file for the specified fill. Read-only.
TextureOffsetX | Returns or sets a Long that specifies the horizontal offset of the texture from the origin in points. Read/write.
TextureOffsetY | Returns or sets a Long that specifies the vertical offset of the texture from the origin in points. Read/write.
TextureType | Returns an MsoTextureType constant indicating the texture type for the specified fill. Read-only.
TextureVerticalScale | Returns or sets a Single that specifies the vertical scaling factor for the texture fill. Read/write.
Transparency | Returns or sets the degree of transparency of the specified fill for a shape as a value between 0.0 (opaque) and 1.0 (clear). Read/write.
Type | Returns an MsoFillType constant that represents the fill format type of a shape. Read-only.
Visible | Returns or sets an MsoTriState constant indicating whether the specified object or the formatting applied to the specified object is visible. Read/write.


WebTextBox.DefaultText Property (Publisher)

 Copy code hover
[image]

WebTextBox.DefaultText Property (Publisher)
Send feedback

Returns or sets a String that represents the default text in a Web text box control. Read/write.

Syntax

expression .DefaultText

expression A variable that represents a WebTextBox object.

Return Value

String

Example

This example creates a new Web text box control in the active publication, sets the default text and the character limit for the text box, and specifies that it is a required control.

Copy code Copy code
Sub AddWebTextBoxControl()
 With ActiveDocument.Pages(1).Shapes.AddWebControl _
 (Type:=pbWebControlMultiLineTextBox, Left:=72, _
 Top:=72, Width:=300, Height:=100).WebTextBox
 .DefaultText = "Please enter text here."
 .Limit = 200
 .RequiredControl = msoTrue
 End With
End Sub


FindReplace.Execute Method (Publisher)

 Copy code hover
[image]

FindReplace.Execute Method (Publisher)
Send feedback

Performs the specified Find or Replace operation.

Syntax

expression .Execute

expression A variable that represents a FindReplace object.

Return Value

Boolean

Example

This example executes a Find and Replace operation on the active document.

VBA Copy code Copy code
Sub ExecuteFindReplace()
 Dim objFindReplace As FindReplace
 Set objFindReplace = ActiveDocument.Find
 With objFindReplace
 .Clear
 .FindText = "library"
 .Execute
 End With
End Sub


AdvancedPrintOptions.BackSideInsertFaceUp Property (Publisher)

 Copy code hover
[image]

AdvancedPrintOptions.BackSideInsertFaceUp Property (Publisher)
See also Send feedback

Gets or sets whether envelopes fed to the printer's manual feed should be inserted back-side first and face up. Read/write.

Version Information

Version Added: Publisher 2007

Syntax

expression .BackSideInsertFaceUp

expression A variable that represents an AdvancedPrintOptions object.

Return Value

Boolean

Remarks

The BackSideInsertFaceUp property setting corresponds to whether the Face up or Face down option is selected when Clockwise rotation is selected under Envelope feed method in the Envelope Setup dialog box in the Microsoft Publisher user interface. (On the File menu, click Print Setup. On the Printer Details tab, click Advanced Printer Setup. On the Printer Setup Wizard tab, click Envelope Setup Dialog).

See also

Concepts

AdvancedPrintOptions Object

Other resources

AdvancedPrintOptions Object Members


Font.UseDiacriticColor Property (Publisher)

 Copy code hover
[image]

Font.UseDiacriticColor Property (Publisher)
Send feedback

Returns or sets MsoTriState constant indicating whether you can set the color of diacritics in the specified text range. Read/write.

Syntax

expression .UseDiacriticColor

expression A variable that represents an Font object.

Return Value

MsoTriState

Remarks

The UseDiacriticColor property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The color of diacritics cannot be set in the specified text range.
msoTriStateMixed | Return value indicating a combination of msoTrue and msoFalse for the specified shape range.
msoTriStateToggle | Set value that switches between msoTrue and msoFalse.
msoTrue | The color of diacritics can be set in the specified text range.

Example

This example test the text in the first story of the publication for the state of the UseDiacriticColor property. If it is msoTrue, the DiacriticColor property value is set to blue. Otherwise, a message box is displayed.

VBA Copy code Copy code
Sub UseDiaColor()

 Dim fntDC As Font

 Set fntDC = Application.ActiveDocument.Stories(1).TextRange.Font
 If fntDC.UseDiacriticColor = msoTrue Then
 fntDC.DiacriticColor.RGB = RGB(Red:=0, Green:=0, Blue:=255)
 Else
 MsgBox "The UseDiacriticColor property is set to False"
 End If

End Sub


Story Object (Publisher)

 Copy code hover
[image]

Story Object (Publisher)
Send feedback

Represents the text in an unlinked text frame, text flowing between linked text frames, or text in a table cell. The Story object is a member of the TextFrame and TextRange objects and the Stories collection.

Example

Use the Story property to return the Story object in a text range or text frame. This example returns the story in the selected text range and, if it is in a text frame, inserts text into the text range.

Copy code Copy code
Sub AddTextToStory()
 With Selection.TextRange.Story
 If .HasTextFrame Then .TextRange _
 .InsertAfter NewText:=vbLf & "This is a test."
 End With
End Sub

Use Stories(index), where index is the number of the story, to return an individual Story object. This example determines if the first story in the active publication has a text frame and, if it does, formats the paragraphs in the story with a half inch first line indent and a six-point spacing before each paragraph.

Copy code Copy code
Sub StoryParagraphFirstLineIndent()
 With ActiveDocument.Stories(1)
 If .HasTextFrame Then
 With .TextFrame.TextRange.ParagraphFormat
 .FirstLineIndent = InchesToPoints(0.5)
 .SpaceBefore = 6
 End With
 End If
 End With
End Sub


PageSize.Application Property (Publisher)

 Copy code hover
[image]

PageSize.Application Property (Publisher)
Send feedback

Returns an Application object that represents the creator of the parent PageSize object. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .Application

expression A variable that represents a PageSize object.

Return Value

Application


PictureFormat.FillFrame Method (Publisher)

 Copy code hover
[image]

PictureFormat.FillFrame Method (Publisher)
Send feedback

Fills the frame of a picture with the image represented by the PictureFormat object. Returns nothing.

Version Information

Version Added: Publisher 2010

Syntax

expression .FillFrame

expression A variable that represents a PictureFormat object.


Document.FindShapesByTag Method (Publisher)

 Copy code hover
[image]

Document.FindShapesByTag Method (Publisher)
Send feedback

Returns a ShapeRange object that represents the shapes with the specified tag.

Syntax

expression .FindShapesByTag(TagName)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
TagName | Required | String | The name of the tag.

Return Value

ShapeRange

Example

This example adds two shapes to the first page of the active publication, assigns each a tag, and then enters the name of each tag into the text frame of its assigned shape.

Copy code Copy code
Sub FindShape()
 Dim strTag1 As String
 Dim strTag2 As String

 With ActiveDocument.Pages(1).Shapes
 With .AddShape(Type:=msoShape5pointStar, Left:=50, _
 Top:=50, Width:=75, Height:=75)
 strTag1 = .Tags.Add(Name:="Star", _
 Value:="This is a star.").Name
 End With

 With .AddShape(Type:=msoShapeHeart, Left:=100, _
 Top:=100, Width:=75, Height:=75)
 strTag2 = .Tags.Add(Name:="Heart", _
 Value:="This is a heart.").Name
 End With
 End With

 With ActiveDocument
 .FindShapesByTag(TagName:=strTag1).TextFrame _
 .TextRange.Text = strTag1
 .FindShapesByTag(TagName:=strTag2).TextFrame _
 .TextRange.Text = strTag2
 End With
End Sub


MailMergeDataSource.TableName Property (Publisher)

 Copy code hover
[image]

MailMergeDataSource.TableName Property (Publisher)
Send feedback

Returns a String that represents the name of the table within the data source file that contains the mail merge records. The returned value may be blank if the table name is unknown or not applicable to the current data source. Read-only.

Syntax

expression .TableName

expression A variable that represents a MailMergeDataSource object.

Return Value

String

Example

This example displays a message with the name of the mail merge data source table name.

VBA Copy code Copy code
Sub EmployeeTable()
 With ActiveDocument.MailMerge.DataSource
 Select Case .TableName
 Case "Employees"
 MsgBox "This is an Employee mail merge publication."
 Case "Customers"
 MsgBox "This is a Customers mail merge publication."
 Case "Suppliers"
 MsgBox "This is a Suppliers mail merge publication."
 Case "Shippers"
 MsgBox "This is a Shippers mail merge publication."
 Case Else
 MsgBox "This is a " & .TableName & " mail merge publication."
 End Select
 End With
End Sub


Sections Object (Publisher)

 Copy code hover
[image]

Sections Object (Publisher)
Send feedback

A collection of all the Section objects in the document.

Example

Use Sections.Item(index) where index is the index number, to return a single Section object. The following example sets the number format and the starting number for the first section of the active document.

Copy code Copy code
With ActiveDocument.Sections.Item(1)
 .PageNumberFormat = pbPageNumberFormatArabic
 .PageNumberStart = 1
End With

Using Sections(index) where index is the index number, will also return a single Section object. The following example sets continues the numbering from the previous section for the second section in the active document.

Copy code Copy code
ActiveDocument.Sections(2).ContinueNumbersFromPreviousSection=True

Use Sections.Count to return the number of sections in the publication. The following example display the number of sections in the first open document.

Copy code Copy code
MsgBox Documents(1).Sections.Count

Use Sections.Add(StartPageIndex) where StartPageIndex is the index number of the page, to reutrn a new section added to a document. A "Permission denied." error will be returned if the page already contains a section head. The following example adds a new section to the second page of the active document.

Copy code Copy code
Dim objSection As Section
Set objSection = ActiveDocument.Sections.Add(StartPageIndex:=2)

Use Sections(index).Delete where index is the index number, to delete the specified section from the document. A "Permission denied" error will be returned if an attempt is made to delete the first section. The following example deletes all of the sections of the active document except the first one.

Note Note

The iteration is from the last to the first to avoid a "Subscript out of range." error when accessing a deleted section in the Sections collection.
Copy code Copy code
Dim i As Long
For i = ActiveDocument.Sections.Count To 1 Step -1
 If i = 1 Then Exit For
 ActiveDocument.Sections(i).Delete
Next i


ReflectionFormat Members (Publisher)

 Copy code hover
[image]

ReflectionFormat Members (Publisher)
Send feedback

Represents the reflection formatting for a shape or range of shapes.

Properties

Name | Description
Blur | Returns or sets a Single that specifies the degree of blur effect applied to the specified object. Read/write.
Offset | Returns or sets the amount of separation, in points, of the reflected image from the shape. Read/write.
Size | Returns or sets the size of the reflection as a percentage of the reflected shape from 0 to 100. Read/write.
Transparency | Returns or sets the degree of transparency for the reflection effect as a value between 0.0 (opaque) and 1.0 (clear). Read/write Single.
Type | Returns or sets an MsoReflectionType constant that represents the type and distance from the shape of the reflection. Read/write.
Visible | True if the specified object or the formatting applied to it is visible. Read/write MsoTriState.


Shapes.Application Property (Publisher)

 Copy code hover
[image]

Shapes.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a Shapes object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Shapes.Paste Method (Publisher)

 Copy code hover
[image]

Shapes.Paste Method (Publisher)
Send feedback

Pastes the shapes or text on the Clipboard into the specified Shapes collection, at the top of the z-order. Each pasted object becomes a member of the specified Shapes collection. If the Clipboard contains a text range, the text will be pasted into a newly created TextFrame shape. Returns a ShapeRange object that represents the pasted objects.

Syntax

expression .Paste

expression A variable that represents a Shapes object.

Return Value

ShapeRange

Example

This example copies shape one on page one in the active publication to the Clipboard and then pastes it into page two.

VBA Copy code Copy code
With ActiveDocument
 .Pages(1).Shapes(1).Copy
 .Pages(2).Shapes.Paste
End With


Section Methods (Publisher)

 Copy code hover
[image]

Section Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified object.


PictureFormat.ColorType Property (Publisher)

 Copy code hover
[image]

PictureFormat.ColorType Property (Publisher)
Send feedback

Returns or sets an MsoPictureColorType constant indicating the type of color transformation applied to the specified picture or OLE object. Read/write.

Syntax

expression .ColorType

expression A variable that represents a PictureFormat object.

Return Value

MsoPictureColorType

Remarks

The ColorType property value can be one of the MsoPictureColorType constants declared in the Microsoft Office type library.

Example

This example sets the color transformation to grayscale for the first shape in the active publication. The shape must be either a picture or an OLE object.

VBA Copy code Copy code
ActiveDocument.Pages(1).Shapes(1).PictureFormat _
 .ColorType = msoPictureGrayScale


PbWizardNavBarDesign Enumeration (Publisher)

 Copy code hover
[image]

PbWizardNavBarDesign Enumeration (Publisher)
Send feedback

Represents the design of the specified Web navigation bar set.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbnbDesignAmbient | 2 | Ambient
pbnbDesignBaseline | 26 | Baseline
pbnbDesignBracket | 11 | Bracket
pbnbDesignBulletStaff | 20 | BulletStaff
pbnbDesignCapsule | 3 | Capsule
pbnbDesignCornice | 15 | Cornice
pbnbDesignCounter | 13 | Counter
pbnbDesignDimension | 8 | Dimension
pbnbDesignDottedArrow | 9 | Dotted Arrow
pbnbDesignEdge | 17 | Edge
pbnbDesignEnclosedArrow | 12 | Enclosed Arrow
pbnbDesignEndCap | 14 | End Cap
pbnbDesignHollowArrow | 10 | Hollow Arrow
pbnbDesignKeyPunch | 22 | Key Punch
pbnbDesignOffset | 7 | Offset
pbnbDesignOutline | 5 | Outline
pbnbDesignRadius | 6 | Radius
pbnbDesignRectangle | 1 | Rectangle
pbnbDesignRoundBullet | 23 | RoundBullet
pbnbDesignSquareBullet | 24 | SquareBullet
pbnbDesignStaff | 16 | Staff
pbnbDesignTopBar | 21 | TopBar
pbnbDesignTopDrawer | 4 | TopDrawer
pbnbDesignTopLine | 18 | TopLine
pbnbDesignUnderscore | 19 | Underscore
pbnbDesignWatermark | 25 | Watermark


pbEmailMergePriority Enumeration (Publisher)

 Copy code hover
[image]

pbEmailMergePriority Enumeration (Publisher)
Send feedback

Constants for merged e-mail message priority passed to and returned by the EmailMergeEnvelope.Priority property.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbPriorityHigh | 1 | High priority
pbPriorityLow | 2 | Low priority
pbPriorityNone | 0 | No priority set


TextRange.Find Property (Publisher)

 Copy code hover
[image]

TextRange.Find Property (Publisher)
Send feedback

Returns a FindReplace object from the specified TextRange object. The FindReplace object is used to perform a text search and replace in the specified text range.

Syntax

expression .Find

expression A variable that represents a TextRange object.


BorderArt Object (Publisher)

 Copy code hover
[image]

BorderArt Object (Publisher)
See also Send feedback

Represents an available type of BorderArt. BorderArt is picture borders that can be applied to text boxes, picture frames, or rectangles. The BorderArt object is a member of the BorderArts collection. The BorderArts collection contains all BorderArt available for use in the specified publication.

Remarks

The BorderArts collection includes any custom BorderArt types created by the user for the specified publication.

Example

Use the Item property of a BorderArts collection to return a specific BorderArt object. The Index argument of the Item property can be the number or name of the BorderArt object.

This example returns the BorderArt "Apples" from the active publication.

Copy code Copy code
Dim bdaTemp As BorderArt

Set bdaTemp = ActiveDocument.BorderArts.Item (Index:="Apples")

Use the Name property to specify which type of BorderArt you want applied to a picture. The following example sets all the BorderArt in a document to the same type using the Name property.

Copy code Copy code
Sub SetBorderArtByName()

Dim anyPage As Page
Dim anyShape As Shape
Dim strBorderArtName As String

strBorderArtName = Document.BorderArts(1).Name

For Each anyPage in ActiveDocument.Pages
For Each anyShape in anyPage.Shapes
With anyShape.BorderArt
If .Exists = True Then
.Name = strBorderArtName
End If
End With
Next anyShape
Next anyPage
End Sub

Note Note

Because Name is the default property of both the BorderArt object and the BorderArtFormat object, you do not need to state it explicitly when setting the BorderArt type. The statement

Shape.BorderArtFormat = Document.BorderArts(1)

is equivalent to

Shape.BorderArtFormat.Name = Document.BorderArts(1).Name

See also

Other resources

BorderArt Object Members


TextFrame.AutoFitText Property (Publisher)

 Copy code hover
[image]

TextFrame.AutoFitText Property (Publisher)
Send feedback

Sets or returns a PbTextAutoFitType constant that represents how Microsoft Publisher automatically adjusts the text font size and the TextFrame objects size for best viewing. Read/write.

Syntax

expression .AutoFitText

expression A variable that represents a TextFrame object.

Return Value

PbTextAutoFitType

Remarks

The AutoFitText property value can be one of the PbTextAutoFitType constants declared in the Microsoft Publisher type library.

Example

The following example tests to see if the text frame has text, and if so, the AutoFitText property is set to best fit.

Copy code Copy code
Sub TextFit()

 Dim tfFrame As TextFrame

 tfFrame = Application.ActiveDocument.MasterPages.Item(1).Shapes(1).TextFrame
 With tfFrame
 If .HasText = msoTrue Then .AutoFitText = pbTextAutoFitBestFit
 End With

End Sub


Sections.Application Property (Publisher)

 Copy code hover
[image]

Sections.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a Sections object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


InstalledPrinters Members (Publisher)

 Copy code hover
[image]

InstalledPrinters Members (Publisher)
Send feedback

Represents the collection of all Printer objects, each of which represents one of the printers installed on the computer.

Properties

Name | Description
Application | Returns an Application object that represents the creator of the parent InstalledPrinters object. Read-only.
Count | Returns the number of printers installed on your computer. Read-only.
Item | Returns the Printer object with the specified name or at the specified index position in the InstalledPrinters collection. Read-only.
Parent | Returns the parent of the InstalledPrinters object. Read-only.


TextRange.ParagraphFormat Property (Publisher)

 Copy code hover
[image]

TextRange.ParagraphFormat Property (Publisher)
Send feedback

Returns a ParagraphFormat object representing the paragraph formatting for the specified text range or text style.

Syntax

expression .ParagraphFormat

expression A variable that represents a TextRange object.

Example

The following example removes all the tab stops from the text in the first shape on page one of the active publication.

Copy code Copy code
Dim pfTemp As ParagraphFormat

Set pfTemp = ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.ParagraphFormat

pfTemp.Tabs.ClearAll


WizardProperty.Values Property (Publisher)

 Copy code hover
[image]

WizardProperty.Values Property (Publisher)
Send feedback

Returns a WizardValues collection representing all the valid values for a wizard property.

Syntax

expression .Values

expression A variable that represents a WizardProperty object.

Return Value

WizardValues

Example

The following example displays the current value for the first wizard property in the active publication and then lists all the other possible values.

VBA Copy code Copy code
Dim valAll As WizardValues
Dim valLoop As WizardValue

With ActiveDocument.Wizard
 Set valAll = .Properties(1).Values

 MsgBox "Wizard: " & .Name & vbLf & _
 "Property: " & .Properties(1).Name & vbLf & _
 "Current value: " & .Properties(1).CurrentValueId

 For Each valLoop In valAll
 MsgBox "Possible value: " & valLoop.ID & " (" & valLoop.Name & ")"
 Next valLoop
End With


Window.Resize Method (Publisher)

 Copy code hover
[image]

Window.Resize Method (Publisher)
Send feedback

Sizes the Microsoft Publisher application window.

Syntax

expression .Resize(Width, Height)

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
Width | Required | Long | The width of the window, in points.
Height | Required | Long | The height of the window, in points.

Remarks

If the window is maximized or minimized, an error occurs.

Use the Width and Height properties to set the window width and height independently.

Example

This example resizes the Publisher application window to 7 inches wide by 6 inches high.

Copy code Copy code
With Application.ActiveWindow
 .WindowState = wdWindowStateNormal
 .Resize Width:=InchesToPoints(7), Height:=InchesToPoints(6)
End With


Application Methods (Publisher)

 Copy code hover
[image]

Application Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
CentimetersToPoints | Converts a measurement from centimeters to points (1 cm = 28.35 points). Returns the converted measurement as a Single.
ChangeFileOpenDirectory | Sets the folder in which Microsoft Publisher searches for documents. The specified folder's contents are listed the next time the Open Publication dialog box (File menu) is displayed.
EmusToPoints | Converts a measurement from emus to points (12700 emus = 1 point). Returns the converted measurement as a Single.
Help | Displays online Help information.
InchesToPoints | Converts a measurement from inches to points (1 inch = 72 points). Returns the converted measurement as a Single.
IsValidObject | Determines whether the specified object variable references a valid object and returns a Boolean value: True if the specified variable that references an object is valid, False if the object referenced by the variable has been deleted.
LinesToPoints | Converts a measurement from lines to points (1 line = 12 points). Returns the converted measurement as a Single.
MillimetersToPoints | Converts a measurement from millimeters to points (1 mm = 2.835 points). Returns the converted measurement as a Single.
NewDocument | Returns a Document object that represents a new publication.
Open | Returns a Document object that represents the newly opened publication.
PicasToPoints | Converts a measurement from picas to points (1 pica = 12 points). Returns the converted measurement as a Single.
PixelsToPoints | Converts a measurement from pixels to points (1 pixel = 0.75 points). Returns the converted measurement as a Single.
PointsToCentimeters | Converts a measurement from points to centimeters (1 cm = 28.35 points). Returns the converted measurement as a Single.
PointsToEmus | Converts a measurement from points to emus (12700 emus = 1 point). Returns the converted measurement as a Single.
PointsToInches | Converts a measurement from points to inches (1 in = 72 points). Returns the converted measurement as a Single.
PointsToLines | Converts a measurement from points to lines (1 line = 12 points). Returns the converted measurement as a Single.
PointsToMillimeters | Converts a measurement from points to millimeters (1 mm = 2.835 points). Returns the converted measurement as a Single.
PointsToPicas | Converts a measurement from points to picas (1 pica = 12 points). Returns the converted measurement as a Single.
PointsToPixels | Converts a measurement from points to pixels (1 pixel = 0.75 points). Returns the converted measurement as a Single.
PointsToTwips | Converts a measurement from points to twips (20 twips = 1 point). Returns the converted measurement as a Single.
Quit | Quits Microsoft Publisher. This is equivalent to clicking Exit on the File menu.
ShowWizardCatalog | Displays the Publication Types catalog for the wizard of the specified type.
TwipsToPoints | Converts a measurement from twips to points (20 twips = 1 point). Returns the converted measurement as a Single.


Font.Size Property (Publisher)

 Copy code hover
[image]

Font.Size Property (Publisher)
Send feedback

Represents the size of the characters in the text range in points. Read/write.

Syntax

expression .Size

expression An expression that returns a Font object.

Return Value

Variant

Example

This example inserts text and then sets the font size of the seventh word of the inserted text to 20 points.

VBA Copy code Copy code
Sub IncreaseFontSizeOfSelection()
 With Selection.TextRange
 .InsertBefore vbLf & "This is a demonstration of font size."
 .Words(7).Font.Size = 20
 End With
End Sub


Attachments.Parent Property (Publisher)

 Copy code hover
[image]

Attachments.Parent Property (Publisher)
See also Send feedback

Returns the parent of the Attachments collection. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .Parent

expression A variable that represents an Attachments object.

Return Value

Object

See also

Concepts

Attachments Collection

Other resources

Attachments Object Members


PictureFormat.IsEmpty Property (Publisher)

 Copy code hover
[image]

PictureFormat.IsEmpty Property (Publisher)
Send feedback

Returns a MsoTriState constant that represents whether the specified shape is an empty picture frame. Read-only.

Syntax

expression .IsEmpty

expression A variable that represents an PictureFormat object.

Return Value

MsoTriState

Remarks

The IsEmpty property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The specified shape is not an empty picture frame.
msoTriStateMixed | Indicates a combination of msoTrue and msoFalse for the specified shape range.
msoTrue | The specified shape is an empty picture frame.

Example

The following example tests each picture in the active publication, and if it is not an empty picture frame, prints selected image properties for the picture.

VBA Copy code Copy code
Dim pgLoop As Page
Dim shpLoop As Shape

For Each pgLoop In ActiveDocument.Pages
 For Each shpLoop In pgLoop.Shapes
 If shpLoop.Type = pbPicture Or shpLoop.Type = pbLinkedPicture Then

 With shpLoop.PictureFormat

 If .IsEmpty = msoFalse Then

 Debug.Print "File Name: " & .Filename
 Debug.Print "Horizontal Scaling: " & .HorizontalScale & "%"
 Debug.Print "Vertical Scaling: " & .VerticalScale & "%"
 Debug.Print "File size in publication: " & .FileSize & " bytes"

 End If

 End With
 End If
 Next shpLoop
Next pgLoop


Shapes.AddShape Method (Publisher)

 Copy code hover
[image]

Shapes.AddShape Method (Publisher)
Send feedback

Adds a new Shape object representing an AutoShape to the specified Shapes collection.

Syntax

expression .AddShape(Type, Left, Top, Width, Height)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | MsoAutoShapeType | The type of AutoShape to draw. For a complete list of MsoAutoShapeType constants, see the Object Browser.
Left | Required | Variant | The position of the left edge of the shape representing the AutoShape.
Top | Required | Variant | The position of the top edge of the shape representing the AutoShape.
Width | Required | Variant | The width of the shape representing the AutoShape.
Height | Required | Variant | The height of the shape representing the AutoShape.

Return Value

Shape

Remarks

For the Left, Top, Width, and Height arguments, numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

Example

The following example adds a rectangle to the first page of the active publication.

Copy code Copy code
Dim shpShape As Shape

Set shpShape = ActiveDocument.Pages(1).Shapes.AddShape _
 (Type:=msoShapeRectangle, _
 Left:=144, Top:=144, _
 Width:=72, Height:=144)


WebPageOptions Properties (Publisher)

 Copy code hover
[image]

WebPageOptions Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
BackgroundSound | Returns or sets a String that specifies the path to a sound file that is played when the Web page is loaded in a Web browser. Read/write.
BackgroundSoundLoopCount | Returns a Long value that specifies the number of times the background sound attached to a Web page is played when the page is loaded in a Web browser. Read-only.
BackgroundSoundLoopForever | Returns a Boolean value that specifies whether the background sound attached to the Web page should be repeated infinitely. Read-only.
Description | Returns or sets a String that represents the description of a Web page within a Web publication. Read/write.
IncludePageOnNewWebNavigationBars | Returns or sets a Boolean value that specifies whether a link to a Web page will be added to the automatic navigation bars of new pages. Read/write.
Keywords | Returns or sets a String that represents the keywords for a Web page within a Web publication. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
PublishFileName | Returns or sets a String that represents the file name of a Web page (within a Web publication) that is being saved as filtered HTML.


FindReplace.MatchWholeWord Property (Publisher)

 Copy code hover
[image]

FindReplace.MatchWholeWord Property (Publisher)
Send feedback

Sets or returns a Boolean that represents whether the whole word will be matched in the search operation. Read/write. Boolean.

Syntax

expression .MatchWholeWord

expression A variable that represents a FindReplace object.

Return Value

Boolean

Remarks

The default value for MatchWholeWord is False.

Example

This example will select each occurrence of the word "fact" and apply bold formatting.

Copy code Copy code
With ActiveDocument.Find
 .Clear
 .MatchWholeWord = True
 .FindText = "fact"
 .ReplaceScope = pbReplaceScopeNone
 Do While .Execute = True
 .FoundTextRange.Font.Bold = msoTrue
 Loop
End With

This example follows the previous example except that whole words will not be matched. Therefore the word "fact" within the word "factory" or "factoid" will also have bold formatting applied.

Copy code Copy code
With ActiveDocument.Find
 .Clear
 .MatchWholeWord = False
 .FindText = "fact"
 .ReplaceScope = pbReplaceScopeNone
 Do While .Execute = True
 .FoundTextRange.Font.Bold = msoTrue
 Loop
End With


ShapeRange.Nodes Property (Publisher)

 Copy code hover
[image]

ShapeRange.Nodes Property (Publisher)
Send feedback

Returns a ShapeNodes collection that represents the geometric description of the specified shape. Applies to Shape or ShapeRange objects that represent freeform drawings.

Syntax

expression .Nodes

expression A variable that represents a ShapeRange object.

Example

This example adds a smooth node with a curved segment after node four in shape three on page one. Shape three must be a freeform drawing with at least four nodes.

Copy code Copy code
With ActiveDocument.Pages(1) _
 .Shapes(3).Nodes
 .Insert Index:=4, SegmentType:=msoSegmentCurve, _
 EditingType:=msoEditingSmooth, X1:=210, Y1:=100
End With


ShapeRange.Name Property (Publisher)

 Copy code hover
[image]

ShapeRange.Name Property (Publisher)
Send feedback

Returns or sets a String value indicating the name of the specified object. Read/write.

Syntax

expression .Name

expression A variable that represents a ShapeRange object.

Remarks

You can use an object's name in conjunction with the Item method or Item property to return a reference to the object if the Item method or property for the collection that contains the object takes a Variant argument. For example, if the value of the Name property for a shape is Rectangle 2, then .Shapes("Rectangle 2") will return a reference to that shape.

The Name property is the default property for the BorderArt, BorderArtFormat, and Label objects.


InstalledPrinters.Parent Property (Publisher)

 Copy code hover
[image]

InstalledPrinters.Parent Property (Publisher)
Send feedback

Returns the parent of the InstalledPrinters object. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .Parent

expression A variable that represents an InstalledPrinters object.

Return Value

Object


Section.StartPageIndex Property (Publisher)

 Copy code hover
[image]

Section.StartPageIndex Property (Publisher)
Send feedback

Returns the page number of the page that the specified Section object begins on. Read-only.

Syntax

expression .StartPageIndex

expression A variable that represents a Section object.

Return Value

Long


FreeformBuilder Object (Publisher)

 Copy code hover
[image]

FreeformBuilder Object (Publisher)
Send feedback

Represents the geometry of a freeform while it is being built.

Example

Use the BuildFreeform method of the Shapes collection to return a FreeformBuilder object. Use the AddNodes method to add nodes to the freeform. Use the ConvertToShape method to create the shape defined in the FreeformBuilder object and add it to the Shapes collection. The following example adds a freeform with four segments to the active document.

Copy code Copy code
Sub CreateNewFreeFormShape()
 With ActiveDocument.Pages(1).Shapes.BuildFreeform( _
 EditingType:=msoEditingCorner, X1:=360, Y1:=200)
 .AddNodes SegmentType:=msoSegmentCurve, _
 EditingType:=msoEditingCorner, X1:=380, Y1:=230, _
 X2:=400, Y2:=250, X3:=450, Y3:=300
 .AddNodes SegmentType:=msoSegmentCurve, _
 EditingType:=msoEditingAuto, X1:=480, Y1:=200
 .AddNodes SegmentType:=msoSegmentLine, _
 EditingType:=msoEditingAuto, X1:=480, Y1:=400
 .AddNodes SegmentType:=msoSegmentLine, _
 EditingType:=msoEditingAuto, X1:=360, Y1:=200
 .ConvertToShape
 End With
End Sub


PageSize.HasBackgroundImage Property (Publisher)

 Copy code hover
[image]

PageSize.HasBackgroundImage Property (Publisher)
Send feedback

Returns True if the blank page size represented by the parent PageSize object has a background image. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .HasBackgroundImage

expression A variable that represents a PageSize object.

Return Value

Boolean

Remarks

The blank page size represented by the parent PageSize object corresponds to one of the icons displayed under Blank Page Sizes in the Page Setup dialog box in the Microsoft Publisher user interface.


TextRange.Duplicate Property (Publisher)

 Copy code hover
[image]

TextRange.Duplicate Property (Publisher)
Send feedback

Returns a TextRange object that represents a duplicate of the specified text range.

Syntax

expression .Duplicate

expression A variable that represents a TextRange object.

Return Value

TextRange

Example

This example sets the value of a string variable to the contents of the specified text box on the first page of the active publication. Then it creates a new page with a text box and sets the contents of the new text box equal to the value of the string variable.

Copy code Copy code
Sub DuplicateTextBoxContents()
 Dim strDuplicate As String
 Dim pagNew As Page

 With ThisDocument.Pages(1).Shapes(1).TextFrame.TextRange
 strDuplicate = .Duplicate
 End With

 Set pagNew = ThisDocument.Pages.Add(Count:=1, After:=1)

 pagNew.Shapes.AddTextbox(Orientation:=pbTextOrientationHorizontal, _
 Left:=72, Top:=72, Width:=200, Height:=200).TextFrame _
 .TextRange.Text = strDuplicate
End Sub


Document.SaveFormat Property (Publisher)

 Copy code hover
[image]

Document.SaveFormat Property (Publisher)
Send feedback

Indicates the file format of the specified document. Read-only.

Syntax

expression .SaveFormat

expression A variable that represents a Document object.

Return Value

PbFileFormat

Remarks

The SaveFormat property value can be one of the PbFileFormat constants declared in the Microsoft Publisher type library.

Example

If the active publication is in the Publisher 2000 format, this example saves it in Rich Text Format (RTF).

VBA Copy code Copy code
Sub SaveAsRTF()

 If Application.ActiveDocument.SaveFormat = pbFilePublisher2000 Then
 ActiveDocument.SaveAs "Flyer3", pbFileRTF
 End If

End Sub


PageSetup.PageWidth Property (Publisher)

 Copy code hover
[image]

PageSetup.PageWidth Property (Publisher)
Send feedback

Returns or sets a Variant that represents the width of the pages in a publication. Read/write.

Version Information

Version Added: Publisher 2007

Syntax

expression .PageWidth

expression A variable that represents a PageSetup object.

Return Value

Variant

Remarks

Numeric values are evaluated as points. String values can be in any unit supported by Microsoft Publisher (for example, "2.5 in"). The valid range of possible values is from zero to the difference between the sheet width and the page width.

Example

The following example sets a width of eight inches for the pages in the active publication.

VBA Copy code Copy code
Public Sub PageWidth_Example()
 ActiveDocument.PageSetup.PageWidth = InchesToPoints(8)
End Sub


Application.MailMergeAfterRecordMerge Event (Publisher)

 Copy code hover
[image]

Application.MailMergeAfterRecordMerge Event (Publisher)
See also Send feedback

Occurs after each record in the data source successfully merges in a mail merge.

Syntax

expression .MailMergeAfterRecordMerge(Doc)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The mail merge main document.

Remarks

If you maintain a customer management database, you can use the MailMergeAfterRecordMerge event to update the database for each merged record.

To access the Application object events, declare an Application object variable in the General Declarations section of a code module. Then set the variable equal to the Application object for which you want to access events. For information about using events with the Microsoft Publisher Application object, see Using Events with the Application Object.

Example

This example displays a message with the value of the first and second fields in the record that has just finished merging.

Copy code Copy code
Private Sub MailMergeApp_MailMergeAfterRecordMerge(ByVal Doc As Document)

 With ActiveDocument.MailMerge.DataSource
 MsgBox .DataFields.Item(3).Value & " " & _
 .DataFields.Item(2).Value & " is finished merging."
 End With

End Sub

For this event to occur, you must place the following line of code in the General Declarations section of your module and run the following initialization routine.

Copy code Copy code
Private WithEvents MailMergeApp As Application

Sub InitializeMailMergeApp()
 Set MailMergeApp = Publisher.Application
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


MailMergeMappedDataField.Value Property (Publisher)

 Copy code hover
[image]

MailMergeMappedDataField.Value Property (Publisher)
Send feedback

Returns a String that represents the value of a mail merge data field record or a mapped data field. Read-only.

Syntax

expression .Value

expression A variable that represents a MailMergeMappedDataField object.


Columns Members (Publisher)

 Copy code hover
[image]

Columns Members (Publisher)
Send feedback

A collection of Column objects that represent the columns in a table.

Methods

Name | Description
Add | Adds a new Column object to the specified Columns collection and returns the new Column object.
Item | Returns an individual Column object in the specified Columns collection.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


EmailMergeEnvelope Object (Publisher)

 Copy code hover
[image]

EmailMergeEnvelope Object (Publisher)
Send feedback

Represents the e-mail container (envelope) that holds the Microsoft Publisher document that is merged into an e-mail merge.

Version Information

Version Added: Publisher 2007

Remarks

The properties of the EmailMergeEnvelope object correspond to the combination of both required and optional settings in the Merge to E-mail dialog box in the Publisher user interface (on the File menu, point to Send E-mail, click Send E-mail Merge, and then click Options).

Before you can use the Execute method of the MailMerge object to send a merged e-mail, you must specify a value for the To property of the EmailMergeEnvelope object, or Publisher will return an error.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to assign some of the properties of an EmailMergeEnvelope object that represents an e-mail merge and then send the resulting e-mail message, an invitation. The macro connects to a data source, assigns values to the To and Subject properties of the EmailMergeEnvelope object, and adds a text box containing merge fields and some additional text to the e-mail message. Then it uses the Execute method of the MailMerge object to execute the merge and send the e-mail.

The data source referenced in this example is a simple tab-deliimited text file that contains three columns with the headings "First," "Last," and "E-mail Address" respectively.

Before running the code, create the text file, add one or more data rows, name the file DataSource.txt, and save it to disk. Then add the file's path to the code by replacing the PathToFile variable with your path.

If you run the code in this example more than once, you will encounter errors because Publisher connects to the data source each time you run the code, resulting in a publication connected to multiple data sources. When multiple data-source connections exist, Publisher inserts an extra column in the master (combined) mail-merge data source to specify the specific data source for each record. As a result, Publisher effectively changes the index number of all the data-source columns, making the indexes used in this code (for example, MailMergeField1) incorrect.

VBA Copy code Copy code
Public Sub EmailMergeEnvelope_Example()

 Dim pubShape As Publisher.Shape
 Dim pubMailMerge As Publisher.MailMerge

 'Connect to the data source.
 Set pubMailMerge = ThisDocument.MailMerge
 pubMailMerge.OpenDataSource "PathToFile\DataSource.txt"

 'Assign "E-mail Address" to the To field of the e-mail message.
 pubMailMerge.EmailMergeEnvelope.To = pubMailMerge.DataSource.DataFields.Item(3)

 'Add text to the Subject field of the e-mail message.
 pubMailMerge.EmailMergeEnvelope.Subject = "Invitation"

 'Insert two merge fields and some additional text in a text box in the body of the message.
 Set pubShape = ThisDocument.Pages(1).Shapes.AddTextbox(pbTextOrientationHorizontal, 100, 100, 200, 100)
 pubShape.TextFrame.TextRange.Text = "Dear "
 pubShape.TextFrame.TextRange.InsertMailMergeField 1
 pubShape.TextFrame.TextRange.InsertAfter " "
 pubShape.TextFrame.TextRange.InsertMailMergeField 2
 pubShape.TextFrame.TextRange.InsertAfter ": "
 pubShape.TextFrame.TextRange.InsertAfter "You are invited!"

 'Perform the merge.
 pubMailMerge.Execute True, pbSendEmail

 'Display a reminder
 MsgBox "If your e-mail client is not already open, remember to open it and send the e-mail messages that are in the outbox."

End Sub


FindReplace.ReplaceScope Property (Publisher)

 Copy code hover
[image]

FindReplace.ReplaceScope Property (Publisher)
Send feedback

Specifies how many scope replacements are to be made: one, all, or none. Read/write.

Syntax

expression .ReplaceScope

expression A variable that represents a FindReplace object.

Return Value

PbReplaceScope

Remarks

The ReplaceScope property value can be one of the PbReplaceScope constants declared in the Microsoft Publisher type library.

The default setting of the ReplaceScope property is pbReplaceScopeNone.

Example

The following example replaces all occurrences of the word "hi" with "hello" in the active document.

VBA Copy code Copy code
With ActiveDocument.Find
 .Clear
 .FindText = "hi"
 .ReplaceWithText = "hello"
 .MatchWholeWord = True
 .ReplaceScope = pbReplaceScopeAll
 .Execute
End With


Application.Open Method (Publisher)

 Copy code hover
[image]

Application.Open Method (Publisher)
See also Send feedback

Returns a Document object that represents the newly opened publication.

Syntax

expression .Open(Filename, ReadOnly, AddToRecentFiles, SaveChanges)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | The name of the publication (paths are accepted).
ReadOnly | Optional | Boolean | True to open the publication as read-only. Default is False.
AddToRecentFiles | Optional | Boolean | True (default) to add the file name to the list of recently used files at the bottom of the File menu.
SaveChanges | Optional | PbSaveOptions | Specifies what Microsoft Publisher should do if there is already an open publication with unsaved changes.
OpenConflictDocument | Optional | Boolean | True to open the local conflict publication if there is an offline conflict. Default is False.

Return Value

Document

Remarks

Because Publisher has a single document interface, the Open method works only when you open a new instance of Publisher. The code sample below shows how to create a new, visible instance of Publisher. When finished with the second instance, you can set the application window's Visible property to False, but the process continues to run in the background, even though it is not visible. To close the second instance, you must set the object equal to Nothing.

The SaveChanges parameter can be one of the PbSaveOption constants declared in the Publisher type library and shown in the following table.

Constant | Description
pbDoNotSaveChanges | Close the open publication without saving any changes.
pbPromptToSaveChanges | Prompt the user whether to save changes in the open publication. The default.
pbSaveChanges | Save the open publication before closing it.

Example

This example creates a second instance of Publisher and opens the specified publication as read-only.

For this example to work, you must replace PathToFile with the path to an existing publication.

VBA Copy code Copy code
Sub OpenNewPub()
 Dim appPub As New Publisher.Application
 appPub.Open FileName:="PathToFile", _
 ReadOnly:=True, AddToRecentFiles:=False, _
 SaveChanges:=pbPromptToSaveChanges
 appPub.ActiveWindow.Visible = True
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


TextRange Object (Publisher)

 Copy code hover
[image]

TextRange Object (Publisher)
Send feedback

Contains the text that is attached to a shape, in addition to properties and methods for manipulating the text. This topic describes how to:

  • Return the text range in any shape you specify.

  • Return a text range from the selection.

  • Return particular characters, words, lines, sentences, or paragraphs from a text range.

  • Insert text, the date and time, or the page number into a text range.

Example

Use the TextRange property of the TextFrame object to return a TextRange object for any shape you specify. Use the Text property to return the string of text in the TextRange object. The following example adds a rectangle to the active publication and sets the text it contains.

Copy code Copy code
Sub AddTextToShape()
    With ActiveDocument.Pages(1).Shapes.AddShape(Type:=msoShapeRectangle, _
        Left:=72, Top:=72, Width:=250, Height:=140)
        .TextFrame.TextRange.Text = "Here is some test text"
    End With
End Sub

Because the Text property is the default property of the TextRange object, the following two statements are equivalent.

Copy code Copy code
ActiveDocument.Pages(1).Shapes(1).TextFrame _
    .TextRange.text = "Here is some test text"
ActiveDocument.Pages(1).Shapes(1).TextFrame _
    .TextRange = "Here is some test text"

Use the HasTextFrame property to determine whether a shape has a text frame, and use the HasText property to determine whether the text frame contains text.

Use the TextRange property of the Selection object to return the currently selected text. The following example copies the selection to the Clipboard.

Copy code Copy code
Sub CopyAndPasteText()
    With ActiveDocument
        .Selection.TextRange.Copy
        .Pages(1).Shapes(1).TextFrame.TextRange.Paste
    End With
End Sub

Use one of the following methods to return a portion of the text of a TextRange object: Characters , Lines , Paragraphs , or Words . The following example formats the second word in the first shape on the first page of the active publication. For this example to work, the specified shape must contain text.

Copy code Copy code
Sub FormatWords()
    With ActiveDocument.Pages(1).Shapes(1).TextFrame _
            .TextRange.Words(2).Font
        .Bold = msoTrue
        .Size = 15
        .Name = "Text Name"
    End With
End Sub

Use one of the following methods to insert characters into a TextRange object: InsertAfter , InsertBefore , InsertDateTime , InsertPageNumber , or InsertSymbol . This example inserts a new line with text after any existing text in the first shape on the first page of the active publication.

Copy code Copy code
Sub InsertNewText()
    Dim intCount As Integer
    With ActiveDocument.Pages(1).Shapes(1).TextFrame _
            .TextRange
        For intCount = 1 To 3
            .InsertAfter vbLf & "This is a test."
        Next intCount
    End With
End Sub


ThreeDFormat.RotationY Property (Publisher)

 Copy code hover
[image]

ThreeDFormat.RotationY Property (Publisher)
Send feedback

Returns or sets the rotation of the extruded shape around the y-axis, in degrees. Can be a value from - 90 through 90. A positive value indicates rotation to the left; a negative value indicates rotation to the right. Read/write Single.

Syntax

expression .RotationY

expression A variable that represents a ThreeDFormat object.

Return Value

Single

Remarks

To set the rotation of the extruded shape around the x-axis, use the RotationX property of the ThreeDFormat object. To set the rotation of the extruded shape around the z-axis, use the Rotation property of the Shape object. To change the direction of the extrusion's sweep path without rotating the front face of the extrusion, use the SetExtrusionDirection method.

Example

This example adds three identical extruded ovals to the active document and sets their rotation around the y-axis to - 30, 0, and 30 degrees, respectively.

VBA Copy code Copy code
Sub SetRotationY()
 With ActiveDocument.Pages(1).Shapes
 With .AddShape(Type:=msoShapeOval, Left:=30, _
 Top:=120, Width:=50, Height:=25).ThreeD
 .Visible = True
 .RotationY = -30
 End With
 With .AddShape(Type:=msoShapeOval, Left:=90, _
 Top:=120, Width:=50, Height:=25).ThreeD
 .Visible = True
 .RotationY = 0
 End With
 With .AddShape(Type:=msoShapeOval, Left:=150, _
 Top:=120, Width:=50, Height:=25).ThreeD
 .Visible = True
 .RotationY = 30
 End With
 End With
End Sub


BorderArtFormat.Exists Property (Publisher)

 Copy code hover
[image]

BorderArtFormat.Exists Property (Publisher)
See also Send feedback

True if the specified BorderArtFormat object exists. Read-only Boolean.

Syntax

expression .Exists

expression A variable that represents a BorderArtFormat object.

See also

Concepts

BorderArtFormat Object

Other resources

BorderArtFormat Object Members


PictureFormat.VerticalPictureLocking Property (Publisher)

 Copy code hover
[image]

PictureFormat.VerticalPictureLocking Property (Publisher)
Send feedback

Returns or sets a PbVerticalPictureLocking constant indicating where newly inserted pictures appear in relation to the specified frame. Read/write.

Syntax

expression .VerticalPictureLocking

expression A variable that represents a PictureFormat object.

Return Value

PbVerticalPictureLocking

Remarks

The Vertical PictureLocking property value can be one of the PbVerticalPictureLocking constants declared in the Microsoft Publisher type library and shown in the following table.

Constant | Description
pbVerticalLockingBottom | New pictures are inserted along the bottom edge of the frame.
pbVerticalLockingNone | New pictures are inserted in the center between the top and bottom edges of the frame.
pbVerticalLockingStretch | New pictures are vertically stretched to the full height of the frame.
pbVerticalLockingTop | New pictures are inserted along the top edge of the frame.

Example

The following example locks the specified picture to the upper-left corner of the picture frame. Shape one on page one of the active publication must be a picture frame for this example to work.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes(1).PictureFormat
 .HorizontalPictureLocking = pbHorizontalLockingLeft
 .VerticalPictureLocking = pbVerticalLockingTop
End With


Printer.IsActivePrinter Property (Publisher)

 Copy code hover
[image]

Printer.IsActivePrinter Property (Publisher)
Send feedback

Gets or sets the printer represented by the parent Printer object as the active printer. Read/write.

Version Information

Version Added: Publisher 2007

Syntax

expression .IsActivePrinter

expression A variable that represents a Printer object.

Return Value

Boolean


Shape.Parent Property (Publisher)

 Copy code hover
[image]

Shape.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a Shape object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Font.SuperScript Property (Publisher)

 Copy code hover
[image]

Font.SuperScript Property (Publisher)
Send feedback

Returns or sets an MsoTriState constant indicating whether characters are formatted as superscript in the specified text range. Read/write.

Syntax

expression .SuperScript

expression A variable that represents a Font object.

Return Value

MsoTriState

Remarks

The SuperScript property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | No characters in the range are formatted as superscript.
msoTriStateMixed | Return value indicating a combination of msoTrue and msoFalse for the specified shape range.
msoTriStateToggle | Set value that switches between msoTrue and msoFalse.
msoTrue | All characters in the range are formatted as superscript.

Setting the SuperScript property to msoTrue removes subscript formatting from the text range.

Example

This example tests the text in the second story and, if it has mixed superscripting, it formats all the text as superscript.

VBA Copy code Copy code
Sub SuperScript()

 Dim fntSuper As Font

 Set fntSuper = Application.ActiveDocument.Stories(2).TextRange.Font
 With fntSuper
 If .SuperScript = msoTriStateMixed Then
 .SuperScript = msoTrue
 Else
 MsgBox "Mixed superscript not in this story."
 End If
 End With

End Sub


TextRange.End Property (Publisher)

 Copy code hover
[image]

TextRange.End Property (Publisher)
Send feedback

Sets or returns a Long that represents the ending character position of a selection or text range. Read/write.

Syntax

expression .End

expression A variable that represents an TextRange object.

Return Value

Long

Example

This example starts the selection on the fiftieth character of the current text box shape and ends on the one hundred fiftieth character, then makes the text bold.

Copy code Copy code
Sub test2()
 With Selection.TextRange
 .Start = 50
 .End = 150
 .Font.Bold = msoTrue
 End With
End Sub


Attachment Members (Publisher)

 Copy code hover
[image]

Attachment Members (Publisher)
Send feedback

Represents an attachment to a merged e-mail message.

Methods

Name | Description
Delete | Deletes an Attachment object from the Attachments collection of an e-mail merge message.

Properties

Name | Description
Name | Returns the name of the attachment. Read-only.


BuildingBlocks Properties (Publisher)

 Copy code hover
[image]

BuildingBlocks Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Microsoft Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns a Long that represents the number of items in the specified collection.
Item | Returns the specified BuildingBlock object from a BuildingBlocks collection. Read-only.
Parent | Returns an object that represents the parent object of the specified object. Read-only.


Font.ItalicBi Property (Publisher)

 Copy code hover
[image]

Font.ItalicBi Property (Publisher)
Send feedback

Returns or sets an MsoTriState constant indicating whether the specified text is formatted as italic; applies to text in a right-to-left language. Read/write.

Syntax

expression .ItalicBi

expression A variable that represents an Font object.

Return Value

MsoTriState

Remarks

The ItalicBi property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | None of the characters in the range are formatted as italic.
msoTriStateMixed | Return value indicating a combination of msoTrue and msoFalse for the specified shape range.
msoTriStateToggle | Set value that switches between msoTrue and msoFalse.
msoTrue | All of the characters in the range are formatted as italic.

Example

This example tests the text in the first story and displays one of two possible text boxes, depending on whether the text is right-to-left formatted and whether its font is formatted as italic.

VBA Copy code Copy code
Sub ItalicRtoL()

 Dim stf As Font

 Set stf = Application.ActiveDocument.Stories(1).TextRange.Font
 With stf
 If .ItalicBi = msoTrue Then
 MsgBox "This story is right-to-left and is formatted as italic."
 Else
 MsgBox "This story is either not right-to-left" & _
 " or it is not formatted as italic"
 End If
 End With

End Sub


Cell Properties (Publisher)

 Copy code hover
[image]

Cell Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
BorderBottom | Returns a CellBorder object that represents the bottom border for a specified table cell.
BorderDiagonal | Returns a CellBorder object that represents the diagonal border for a specified table cell.
BorderLeft | Returns a CellBorder object that represents the left border for a specified table cell.
BorderRight | Returns a CellBorder object that represents the right border for a specified table cell.
BorderTop | Returns a CellBorder object that represents the top border for a specified table cell.
CellTextOrientation | Returns or sets a PbTextOrientation that represents the flow of text in a specified table cell. Read/write.
Column | Returns a Long that represents the table column containing the specified cell. Read-only.
Diagonal | Sets or returns a PbCellDiagonalType constant that represents a cell that is diagonally split. Read/write.
Fill | Returns a FillFormat object representing the fill for the specified shape or table cell.
HasText | Returns a Boolean value indicating whether the specified cell contains any text. ReturnsTrue if the specified cell contains text. Read-only.
Height | Returns a Long that represent the height (in cells) of a table, range of cells, or page. Read-only.
MarginBottom | Returns or sets a Variant that represents the amount of space (in points) between the text and the bottom edge of a cell, text frame, or page. Read/write.
MarginLeft | Returns or sets a Variant that represents the amount of space (in points) between the text and the left edge of a cell, text frame, or page. Read/write.
MarginRight | Returns or sets a Variant that represents the amount of space (in points) between the text and the right edge of a cell, text frame, or page. Read/write.
MarginTop | Returns or sets a Variant that represents the amount of space (in points) between the text and the top edge of a cell, text frame, or page. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Row | Returns a Long that represents the row number containing the specified cell. Read-only.
Selected | Returns True if a cell is selected. Read-only Boolean.
TextRange | Returns a TextRange object that represents the text that is attached to a shape and properties and methods for manipulating the text.
VerticalTextAlignment | Returns or sets a PbVerticalTextAlignmentType constant that represents the vertical alignment of text in a text box. Read/write.
Width | Returns a Long that represent the width (in cells) of a table, range of cells, or page. Read-only.


TextRange.InsertSymbol Method (Publisher)

 Copy code hover
[image]

TextRange.InsertSymbol Method (Publisher)
Send feedback

Returns a TextRange object that represents a symbol inserted in place of the specified range or selection.

Syntax

expression .InsertSymbol(FontName, CharIndex)

expression A variable that represents a TextRange object.

Parameters

Name | Required/Optional | Data Type | Description
FontName | Required | String | The name of the font that contains the symbol.
CharIndex | Required | Long | The Unicode character for the specified symbol.

Return Value

TextRange

Remarks

If you do not want to replace the range or selection, use the TextRange.Collapse Method (Publisher) before you use this method.

Example

This example inserts a double-headed arrow at the cursor.

VBA Copy code Copy code
Sub Insert Arrow()
    ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange _
            .Paragraphs(Start:=1, Length:=1).Select
    With .TextFrame.TextRange
            .InsertPageNumber
            .Collapse Direction:= pbCollapseStart
            .InsertSymbol FontName:="Symbol", CharIndex:=171
        End With
End Sub


Window.Visible Property (Publisher)

 Copy code hover
[image]

Window.Visible Property (Publisher)
Send feedback

True if the window is visible. Read/write Boolean.

Syntax

expression .Visible

expression A variable that represents a Window object.

Example

This example hides the Publisher window.

VBA Copy code Copy code
ActiveWindow.Visible = False


Application.AutomationSecurity Property (Publisher)

 Copy code hover
[image]

Application.AutomationSecurity Property (Publisher)
See also Send feedback

Specifies the security mode that Microsoft Publisher uses when programmatically opening files. Read/write.

Version Information

Version Added: Publisher 2007

Syntax

expression .AutomationSecurity

expression A variable that represents an Application object.

Return Value

MsoAutomationSecurity

See also

Concepts

Application Object

Other resources

Application Object Members


HeaderFooter Properties (Publisher)

 Copy code hover
[image]

HeaderFooter Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
IsHeader | True if the specified HeaderFooter object is a header, False if it is a footer. Read-only Boolean.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
TextRange | Returns a TextRange object that represents the text that is attached to a shape and properties and methods for manipulating the text.


PageSizes.Parent Property (Publisher)

 Copy code hover
[image]

PageSizes.Parent Property (Publisher)
Send feedback

Returns the parent of the PageSizes collection. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .Parent

expression A variable that represents a PageSizes collection.

Return Value

Object


WebCheckBox Members (Publisher)

 Copy code hover
[image]

WebCheckBox Members (Publisher)
Send feedback

Represents a Web check box control. The WebCheckBox object is a member of the Shape object.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
ReturnDataLabel | Returns or sets a String that represents the text used by the Web page to label the specified Web object when the page is submitted. Read/write.
Selected | Specifies whether a Web check box or option button is selected. Read/write.
Value | Returns or sets a String that represents the value of a Web check box or option button. Read/write.


TextEffectFormat.ToggleVerticalText Method (Publisher)

 Copy code hover
[image]

TextEffectFormat.ToggleVerticalText Method (Publisher)
Send feedback

Switches the text flow in the specified WordArt from horizontal to vertical, or vice versa.

Syntax

expression .ToggleVerticalText

expression A variable that represents a TextEffectFormat object.

Remarks

Using the ToggleVerticalText method swaps the values of the Left and Top properties of the Shape object that represents the WordArt and leaves the Width and Height properties unchanged.

The Flip method and Rotation property of the Shape object and the RotatedChars property and ToggleVerticalText method of the TextEffectFormat object all affect the character orientation and the direction of text flow in a Shape object that represents WordArt. You may have to experiment to find out how to combine the effects of these properties and methods to get the result you want.

Example

This example adds WordArt that contains the text "Test" to the active publication, and switches from horizontal text flow (the default for the specified WordArt style, msoTextEffect1) to vertical text flow.

Copy code Copy code
Dim shpTextEffect As Shape

Set shpTextEffect = ActiveDocument.Pages(1).Shapes.AddTextEffect _
 (PresetTextEffect:=msoTextEffect1, Text:="Test", _
 FontName:="Arial Black", FontSize:=36, _
 FontBold:=False, FontItalic:=False, Left:=100, Top:=100)

shpTextEffect.TextEffect.ToggleVerticalText


Application.NewDocument Event (Publisher)

 Copy code hover
[image]

Application.NewDocument Event (Publisher)
See also Send feedback

Occurs when a new publication is created.

Syntax

expression .NewDocument(Doc, )

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The new document.

Example

This example displays a message when a new publication is created.

Copy code Copy code
Private Sub appPub_NewDocument(ByVal Doc As Document)
 MsgBox "This is a new publication."
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


LinkFormat.Parent Property (Publisher)

 Copy code hover
[image]

LinkFormat.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a LinkFormat object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


WebListBox.ListBoxItems Property (Publisher)

 Copy code hover
[image]

WebListBox.ListBoxItems Property (Publisher)
Send feedback

Returns a WebListBoxItems object that represents the items in a Web list box control.

Syntax

expression .ListBoxItems

expression A variable that represents a WebListBox object.

Return Value

WebListBoxItems

Example

This example creates a new Web list box control and adds five new list items to it.

Copy code Copy code
Sub NewListBoxItems()
 Dim intCount As Integer
 With ActiveDocument.Pages(1).Shapes.AddWebControl _
 (Type:=pbWebControlListBox, Left:=100, _
 Top:=100, Width:=150, Height:=100).WebListBox
 .MultiSelect = msoTrue
 With .ListBoxItems
 For intCount = 1 To .Count
 .Delete (1)
 Next
 .AddItem Item:="Yellow"
 .AddItem Item:="Red"
 .AddItem Item:="Blue"
 .AddItem Item:="Green"
 .AddItem Item:="Black"
 End With
 End With
End Sub


WebNavigationBarSet.Design Property (Publisher)

 Copy code hover
[image]

WebNavigationBarSet.Design Property (Publisher)
Send feedback

Sets or returns a PbWizardNavBarDesign constant representing the design of the specified Web navigation bar set. Read/write.

Syntax

expression .Design

expression A variable that represents a WebNavigationBarSet object.

Return Value

PbWizardNavBarDesign

Remarks

The Design property value can be one of the PbWizardNavBarDesign constants declared in the Microsoft Publisher type library.

Example

This example adds a new Web navigation bar set to every page in the active document, sets the button style to large, and then sets the design property to pbnbDesignCapsule.

VBA Copy code Copy code
Dim objWebNav As WebNavigationBarSet
Set objWebNav = ActiveDocument.WebNavigationBarSets.AddSet(Name:="newNavBar")
With objWebNav
 .AddToEveryPage Left:=10, Top:=10
 .ButtonStyle = pbnbButtonStyleLarge
 .Design = pbnbDesignCapsule
End With


PageBackground Object (Publisher)

 Copy code hover
[image]

PageBackground Object (Publisher)
Send feedback

Represents the background of a page.

Example

Use the Background property of a Page object to return a PageBackground object. The following example creates a PageBackground object and sets it to the background of the first page of the active document.

Copy code Copy code
Dim objPageBackground As PageBackground
Set objPageBackground = ActiveDocument.Pages(1).Background

Use PageBackground.Exists to determine if a background already exists for the specified Page object. The following example builds upon the previous example. First a PageBackground object is created and set to the background of the first page of the active document. Then a test is made to check if a background exists for the page already. If not then one is created by calling the Create method of the PageBackground object.

Copy code Copy code
Dim objPageBackground As PageBackground
Set objPageBackground = ActiveDocument.Pages(1).Background
If objPageBackground.Exists = False Then
 objPageBackground.Create
End If

Use PageBackground.Fill to return a FillFormat object. The following example builds upon the previous example. First a PageBackground object is created and set to the background of the first page of the active document. Then a test is made to check if a background exists for the page already. If not then one is created by calling the Create method of the PageBackground object. A FillFormat object is returned by using the Fill property of the PageBackground object. A few of the available properties of the FillFormat object are then set.

Copy code Copy code
Dim objPageBackground As PageBackground
Dim objFillFormat As FillFormat

Set objPageBackground = ActiveDocument.Pages(1).Background
If objPageBackground.Exists = False Then
 objPageBackground.Create
End If

Set objFillFormat = objPageBackground.Fill
With objFillFormat
 .BackColor.RGB = RGB(Red:=0, GReen:=155, Blue:=99)
 .ForeColor.RGB = RGB(Red:=155, GReen:=234, Blue:=0)
 .TwoColorGradient msoGradientDiagonalDown, 4
End With

Use PageBackground.Delete to delete a background for the specified page. The following example deletes the background of the first page in the active document. (The following example assumes the specified page has an existing background. A run-time error occurs if the page does not contain a background.)

Copy code Copy code
ActiveDocument.Pages(1).Background.Delete


PbSubmitDataFormatType Enumeration (Publisher)

 Copy code hover
[image]

PbSubmitDataFormatType Enumeration (Publisher)
Send feedback

Represents the format to use when saving Web form data to a file.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbSubmitDataFormatCSV | 3 | Saves Web form data to a comma-delimited text file.
pbSubmitDataFormatHTML | 1 | Saves Web form data to an HTML file.
pbSubmitDataFormatRichText | 2 | Saves Web form data to a formatted file.
pbSubmitDataFormatTab | 4 | Saves Web form data to a tab-delimited text file.


Application Events (Publisher)

 Copy code hover
[image]

Application Events (Publisher)
Send feedback

This object has the following events:

Events

Name | Description
AfterPrint | Fires after all variables and fields print.
BeforePrint | Occurs before the publication is printed or previewed. .
DocumentBeforeClose | Occurs immediately before any open document closes.
DocumentOpen | Occurs when opening a document.
HideCatalogUI | Occurs when the catalog of publication wizards is hidden in the Microsoft Publisher user interface.
MailMergeAfterMerge | Occurs after all records in a mail merge have merged successfully.
MailMergeAfterRecordMerge | Occurs after each record in the data source successfully merges in a mail merge.
MailMergeBeforeMerge | Occurs when a merge is executed before any records in a mail merge have merged.
MailMergeBeforeRecordMerge | Occurs as a merge is executed for the individual records in a merge.
MailMergeDataSourceLoad | Occurs when the data source is loaded for a mail merge.
MailMergeDataSourceValidate | Occurs when a user performs address verification by clicking Validate in the Mail Merge Recipients dialog box.
MailMergeGenerateBarcode | Occurs when Microsoft Publisher requires data to generate barcodes in a mail-merge publication, in particular when the mail-merge recipient list changes.
MailMergeInsertBarcode | Occurs when the user issues the command to insert postal barcodes into a mail-merge publication, either in the Microsoft Publisher user interface (UI), or programmatically.
MailMergeRecipientListClose | Fires when the user closes the Mail Merge Recipients dialog box. (From the Mail Merge or E-mail Merge task pane, click Edit Recipient List). Also fires when the user closes the Catalog Merge Product List dialog box, which opens when the user clicks Edit Product List in the Catalog Merge task pane.
MailMergeWizardFollowUpCustom | Fires when the string that appears as the fourth item under Prepare to follow-up on this mailing on the third Mail Merge task pane in the Microsoft Publisher user interface is clicked.
MailMergeWizardStateChange | Occurs when a user changes from a specified step to a specified step in the Mail Merge Wizard.
NewDocument | Occurs when a new publication is created.
Quit | Occurs when the user exits Microsoft Publisher.
ShowCatalogUI | Fires when the catalog of publication wizards is displayed in the Microsoft Publisher user interface.
WindowActivate | Occurs when the application window is activated.
WindowDeactivate | Occurs when the application window is deactivated.
WindowPageChange | Occurs when switching the view from one page to another page in a publication.


MailMergeDataSource.ValidatedClean Property (Publisher)

 Copy code hover
[image]

MailMergeDataSource.ValidatedClean Property (Publisher)
Send feedback

Indicates whether all recipient addresses in the the parent MailMergeDataSource object were successfully validated, and whether any changes are made to the list since the last validation that require the list to be validated again. Read/write.

Version Information

Version Added: Publisher 2007

Syntax

expression .ValidatedClean

expression A variable that represents a MailMergeDataSource object.

Return Value

Boolean

Remarks

If you create an add-in for Microsoft Publisher that validates recipient addresses and maintains its own data sources, your add-in can set the ValidatedClean property value to True after a successful validation.

The ValidatedClean property value is not persisted in the Publisher file, and is set to False by default when you first open a publication.

Publisher resets the ValidatedClean property value to False whenever you add a new data source, change a filter setting, or change a sort setting.


Shapes Properties (Publisher)

 Copy code hover
[image]

Shapes Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
CanvasArrangementType | A pbCanvasArrangementType constant that specifies the arrangement type of the canvas. Read/write.
CanvasesCount | A Long that specifies the number of canvases in the Shapes collection. Read-only.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Shape Object (Publisher)

 Copy code hover
[image]

Shape Object (Publisher)
Send feedback

Represents an object in the drawing layer, such as an AutoShape, freeform, OLE object, ActiveX control, or picture. The Shape object is a member of the Shapes collection, which includes all the shapes on a page or in a selection.

Note Note

There are three objects that represent shapes: the Shapes collection, which represents all the shapes on a document; the ShapeRange collection, which represents a specified subset of the shapes on a document (for example, a ShapeRange object could represent shapes one and four on the document, or it could represent all the selected shapes on the document); the Shape object, which represents a single shape on a document. If you want to work with several shape at the same time or with shapes within the selection, use a ShapeRange collection. This section describes how to:

  • Return an existing shape on a document.

  • Return a shape or shapes within a selection.

  • Return a newly created shape.

  • Work with a group of shapes.

  • Format a shape.

  • Use other important shape properties.

Example

Use Shapes (index), where index is the name or the index number, to return a single Shape object. The following example horizontally flips shape one on the active document.

Copy code Copy code
Sub FlipShape()
    ActiveDocument.Pages(1).Shapes(1).Flip FlipCmd:=msoFlipHorizontal
End Sub

The following example horizontally flips the shape named "Rectangle 1" on the active document.

Copy code Copy code
Sub FlipShapeByName()
    ActiveDocument.Pages(1).Shapes("Rectangle 1") _
        .Flip FlipCmd:=msoFlipHorizontal
End Sub

Each shape is assigned a default name when it is created. For example, if you add three different shapes to a document, they might be named "Rectangle 2," "TextBox 3," and "Oval 4." To give a shape a more meaningful name, set the Name property of the shape.

Use Selection.ShapeRange(index), where index is the name or the index number, to return a Shape object that represents a shape within a selection. The following example sets the fill for the first shape in the selection, assuming that the selection contains at least one shape.

Copy code Copy code
Sub FillSelectedShape()
    Selection.ShapeRange(1).Fill.ForeColor.RGB = RGB(255, 0, 0)
End Sub

The following example sets the fill for all the shapes in the selection, assuming that the selection contains at least one shape.

Copy code Copy code
Sub FillAllSelectedShapes()
    Dim shpShape As Shape
    For Each
Copy code Copy code
shpShape In Selection.ShapeRange
Copy code Copy code
shpShape.Fill.ForeColor.RGB = RGB(Red:=255, Green:=0, Blue:=0)
    Next shpShape
End Sub

To add a Shape object to the collection of shapes for the specified document and return a Shape object that represents the newly created shape, use one of the following methods of the Shapes collection: AddCallout , AddConnector , AddCurve , AddLabel , AddLine , AddOLEObject , AddPolyline , AddShape , AddTextBox or AddTextEffect . The following example adds a rectangle to the active document.

Copy code Copy code
Sub AddNewShape()
    ActiveDocument.Pages(1).Shapes.AddShape Type:=msoShapeRectangle, _
        Left:=400, Top:=72, Width:=100, Height:=200
End Sub

Use GroupItems (index), where index is the shape name or the index number within the group, to return a Shape object that represents a single shape in a grouped shape. Use the Group or Regroup method to group a range of shapes and return a single Shape object that represents the newly formed group. After a group has been formed, you can work with the group the same way you work with any other shape. This example adds three shapes to the active publication, groups the shapes, and sets the fill color for each of the shapes in the group

Copy code Copy code
Sub WorkWithGroupShapes()

    With ActiveDocument.Pages(1).Shapes
        .AddShape Type:=msoShapeIsoscelesTriangle, Left:=100, _
            Top:=72, Width:=100, Height:=100
        .AddShape Type:=msoShapeIsoscelesTriangle, Left:=250, _
            Top:=72, Width:=100, Height:=100
        .AddShape Type:=msoShapeIsoscelesTriangle, Left:=400, _
            Top:=72, Width:=100, Height:=100
        .SelectAll

        With Selection.ShapeRange
            .Group
            .GroupItems(1).Fill.ForeColor _
                .RGB = RGB(Red:=255, Green:=0, Blue:=0)
            .GroupItems(2).Fill.ForeColor _
                .RGB = RGB(Red:=0, Green:=255, Blue:=0)
            .GroupItems(3).Fill.ForeColor _
                .RGB = RGB(Red:=0, Green:=0, Blue:=255)
        End With
    End With
End Sub

Use the Fill property to return the FillFormat object, which contains all the properties and methods for formatting the fill of a closed shape. The Shadow property returns the ShadowFormat object, which you use to format a shadow. Use the Line property to return a LineFormat object, which contains properties and methods for formatting lines and arrows. The TextEffect property returns the TextEffectFormat object, which you use to format WordArt. The Callout property returns the CalloutFormat object, which you use to format line callouts. The TextWrap property returns the WrapFormat object, which you use to define how text wraps around shapes. The ThreeD property returns the ThreeDFormat object, which you use to create 3-D shapes. You can use the PickUp and Apply methods to transfer formatting from one shape to another.

Use the SetShapesDefaultProperties method for a Shape object to set the formatting for the default shape for the document. New shapes inherit many of their attributes from the default shape.

Use the Type property to specify the type of shape: freeform, AutoShape, OLE object, callout, or linked picture, for instance. Use the AutoShapeType property to specify the type of AutoShape: oval, rectangle, or balloon, for instance.

Use the Width and Height properties to specify the size of the shape.

Use TextFrame and TextRange properties to return the TextFrame and TextRange objects, respectively, which contain all the properties and methods for inserting and formatting text within shapes and publications and linking the text frames together. The following example adds a text box to the first page of the active publication, then adds text to it and formats the text.

Copy code Copy code
Sub CreateNewTextBox()
    With ActiveDocument.Pages(1).Shapes.AddTextbox( _
        Orientation:=pbTextOrientationHorizontal, Left:=100, _
        Top:=100, Width:=200, Height:=100).TextFrame.TextRange
        .Text = "This is a textbox."
        With .Font
            .Name = "Stencil"
            .Bold = msoTrue
            .Size = 30
        End With
    End With
End Sub


Page.PageNumber Property (Publisher)

 Copy code hover
[image]

Page.PageNumber Property (Publisher)
Send feedback

Returns a String that represents the current page number. Read-only.

Syntax

expression .PageNumber

expression A variable that represents a Page object.

Return Value

String

Example

This example creates a text box, gets the current page number, and inserts it with new text into the new shape.

VBA Copy code Copy code
Sub GetPageNumber()
 Dim strPageNumber As String
 With ActiveDocument.Pages(1)
 strPageNumber = .PageNumber
 .Shapes.AddTextbox(Orientation:=pbTextOrientationHorizontal, _
 Left:=100, Top:=100, Width:=100, Height:=100) _
 .TextFrame.TextRange.InsertAfter NewText:="This is page " _
 & strPageNumber & " of " & .Parent.Count & "."
 End With
End Sub


TextEffectFormat Object (Publisher)

 Copy code hover
[image]

TextEffectFormat Object (Publisher)
Send feedback

Contains properties and methods that apply to WordArt objects.

Example

Use the TextEffect property to return a TextEffectFormat object. The following example sets the font name and formatting for shape one on the first page of the active publication. For this example to work, shape one must be a WordArt object.

Copy code Copy code
Sub FormatWordArt()
 With ActiveDocument.Pages(1).Shapes(1).TextEffect
 .FontName = "Courier New"
 .FontBold = MsoTrue
 .FontItalic = MsoTrue
 End With
End Sub


LayoutGuides Members (Publisher)

 Copy code hover
[image]

LayoutGuides Members (Publisher)
Send feedback

Represents the measurement grid that appears superimposed on publication pages as an aid to laying out design elements.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
ColumnGutterWidth | Returns or sets the width of the column gutters that are used by the LayoutGuides object to aid in the process of laying out design elements. Read/write Single.
Columns | Returns or sets a Long that represents the number of guide columns on a page or the number of columns in a text frame. Read/write.
GutterCenterlines | Returns or sets a value that specifies whether to add a center line between the columns and rows of the gutter guides in a master page. Read/write Boolean.
HorizontalBaseLineOffset | Returns a Single that represents the horizontal baseline offset of the specified LayoutGuides object. Read/Write.
HorizontalBaseLineSpacing | Returns a Single that represents the horizontal baseline spacing of the specified LayoutGuides object. Read/write.
MarginBottom | Returns or sets a Variant that represents the amount of space (in points) between the text and the bottom edge of a cell, text frame, or page. Read/write.
MarginLeft | Returns or sets a Variant that represents the amount of space (in points) between the text and the left edge of a cell, text frame, or page. Read/write.
MarginRight | Returns or sets a Variant that represents the amount of space (in points) between the text and the right edge of a cell, text frame, or page. Read/write.
MarginTop | Returns or sets a Variant that represents the amount of space (in points) between the text and the top edge of a cell, text frame, or page. Read/write.
MirrorGuides | Returns or sets a Boolean indicating whether Microsoft Publisher creates mirror guide positions for a book fold publication. True if Publisher creates mirror guide positions for separate left and right pages in a book fold publication; False if the same margin, row, and column guides are applied to all pages in the publication. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
RowGutterWidth | Returns or sets the width of the row gutters that are used by the LayoutGuides object to aid in the process of laying out design elements. Read/write Single.
Rows | Sets or returns a Long that represents the number of rows in a layout guide. Read/write.
VerticalBaseLineOffset | Returns a Single that represents the vertical baseline offset of the specified LayoutGuides object. Read/write.
VerticalBaseLineSpacing | Returns a Single that represents the vertical baseline spacing of the specified LayoutGuides object. Read/write.


Stories Object (Publisher)

 Copy code hover
[image]

Stories Object (Publisher)
Send feedback

Represents all the text in a publication.

Example

Use the Stories property of a Document object to return a Stories collection. Use the Item method of the Stories collection to access individual Story objects.

The Stories collection enables efficient access to text in a publication. A simple loop through the Stories collection can scan all text in text frames or tables without the need to search each shape on every page of a publication.

The Stories collection contains one Story object for each unlinked text frame, each chain of linked text frames, and each table in a publication. Text in WordArt frames, OLE objects, and pictures are not included in the Stories collection.

This example assigns the first story in the active publication to an object variable.

Copy code Copy code
Dim stFirst As Story

stFirst = Application.ActiveDocument.Stories(1)


WebPageOptions Object (Publisher)

 Copy code hover
[image]

WebPageOptions Object (Publisher)
Send feedback

Represents the properties of a single Web page within a Web publication, including options for adding the title and description of the page, background sounds, in addition to other options. The WebPageOptions object is a member of the Page object.

Remarks

Note that the WebPageOptions object is only available when the active publication is a Web publication. A run-time error is returned if trying to access this object from a print publication.

Example

Use the WebPageOptions property on the Page object to return a WebPageOptions object. Use the Description property to set the description of a specified Web page. The following example sets the description for the second page of the active Web publication.

Copy code Copy code
Dim theWPO As WebPageOptions

Set theWPO = ActiveDocument.Pages(2).WebPageOptions

With theWPO
 .Description = "Company Profile"
End With


MailMergeDataSources.Creator Property (Publisher)

 Copy code hover
[image]

MailMergeDataSources.Creator Property (Publisher)
Send feedback

Returns a 32-bit integer that indicates the application in which the MailMergeDataSources object was created. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .Creator

expression A variable that represents a MailMergeDataSources object.

Return Value

Integer


Shape.Apply Method (Publisher)

 Copy code hover
[image]

Shape.Apply Method (Publisher)
Send feedback

Applies formatting copied from another shape or shape range using the PickUp method.

Syntax

expression .Apply

expression A variable that represents a Shape object.

Return Value

Nothing

Remarks

If you do not first use the PickUp method to copy the formatting from another shape, an error occurs.

Example

The following example copies the formatting from the first shape of the active publication to the second shape of the active publication.

Copy code Copy code
With ActiveDocument.Pages(1)
 .Shapes(1).PickUp
 .Shapes(2).Apply
End With


WebTextBox Members (Publisher)

 Copy code hover
[image]

WebTextBox Members (Publisher)
Send feedback

Represents a Web text box control. The WebTextBox object is a member of the Shape object.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
DefaultText | Returns or sets a String that represents the default text in a Web text box control. Read/write.
EchoAsterisks | Specifies whether asterisks should be displayed in place of text that is entered into a Web text box control. Read/write.
Limit | Returns or sets a Long that represents the maximum number of characters that can be entered into a Web text box control. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
RequiredControl | Specifies whether an entry into a Web text box control is required. Read/write.
ReturnDataLabel | Returns or sets a String that represents the text used by the Web page to label the specified Web object when the page is submitted. Read/write.


ColorsInUse.Application Property (Publisher)

 Copy code hover
[image]

ColorsInUse.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a ColorsInUse object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


ShapeRange.RemoveFromCatalogMergeArea Method (Publisher)

 Copy code hover
[image]

ShapeRange.RemoveFromCatalogMergeArea Method (Publisher)
Send feedback

Removes a shape from the specified page's catalog merge area. Removed shapes are not deleted, but instead remain in place on the page containing the catalog merge area.

Syntax

expression .RemoveFromCatalogMergeArea

expression A variable that represents a ShapeRange object.

Remarks

Use the AddToCatalogMergeArea method of the Shape or ShapeRange objects to add shapes to a catalog merge area.

Use the RemoveCatalogMergeArea method of the Shape object to remove the catalog merge area from a publication page, but leave the shapes it contains.

Example

The following example tests whether any page of the specified publication contains a catalog merge area. If any page does, all the shapes are removed from the catalog merge area and deleted, and the catalog merge area is then removed from the publication.

Copy code Copy code
Sub DeleteCatalogMergeAreaAndAllShapesWithin()
 Dim pgPage As Page
 Dim mmLoop As Shape
 Dim intCount As Integer
 Dim strName As String

 For Each pgPage In ThisDocument.Pages
 For Each mmLoop In pgPage.Shapes

 If mmLoop.Type = pbCatalogMergeArea Then
 With mmLoop.CatalogMergeItems
 For intCount = .Count To 1 Step -1
 strName = mmLoop.CatalogMergeItems.Item(intCount).Name
 .Item(intCount).RemoveFromCatalogMergeArea
 pgPage.Shapes(strName).Delete
 Next
 End With
 mmLoop.RemoveCatalogMergeArea
 End If

 Next mmLoop
 Next pgPage

 End Sub


Shape.ScaleHeight Method (Publisher)

 Copy code hover
[image]

Shape.ScaleHeight Method (Publisher)
Send feedback

Scales the height of the shape by a specified factor. For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original size or relative to the current size.

Syntax

expression .ScaleHeight(Factor, RelativeToOriginalSize, fScale)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Factor | Required | Single | Specifies the ratio between the height of the shape after you resize it and the current or original height. For example, to make a rectangle 50 percent larger, specify 1.5 for this argument.
RelativeToOriginalSize | Required | MsoTriState | Specifies whether to scale relative to the object's original or current size.
fScale | Optional | MsoScaleFrom | The part of the shape that retains its position when the shape is scaled.

Remarks

The RelativeToOriginalSize parameter can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | Scales the shape relative to its current size.
msoTrue | Scales the shape relative to its original size.

The fScale parameter can be one of the MsoScaleFrom constants declared in the Microsoft Office type library and shown in the following table. The default is msoScaleFromTopLeft.

msoScaleFromBottomRight

msoScaleFromMiddle

msoScaleFromTopLeft

Shapes other than pictures and OLE objects are always scaled relative to their current height; specifying a RelativeToOriginalSize value of msoTrue for shapes other than pictures or OLE objects causes an error.

Use the ScaleWidth method to scale the width of a shape.

Example

This example scales all pictures and OLE objects on the first page of the active publication to 175 percent of their original height and width, and it scales all other shapes to 175 percent of their current height and width.

VBA Copy code Copy code
' Looping variable.
Dim shpLoop As Shape

' Loop through all the shapes on the first page.
For Each shpLoop In ActiveDocument.Pages(1).Shapes
 With shpLoop
 Select Case .Type
 ' If the shape is a picture or OLE object,
 ' scale relative to original size.
 Case pbPicture, pbLinkedPicture, _
 pbEmbeddedOLEObject, pbLinkedOLEObject, _
 pbOLEControlObject
 .ScaleHeight Factor:=1.75, _
 RelativeToOriginalSize:=True
 .ScaleWidth Factor:=1.75, _
 RelativeToOriginalSize:=True
 ' If the shape is not a picture or OLE object,
 ' scale relative to the current size.
 Case Else
 .ScaleHeight Factor:=1.75, _
 RelativeToOriginalSize:=False
 .ScaleWidth Factor:=1.75, _
 RelativeToOriginalSize:=False
 End Select
 End With
Next shpLoop


Application.MailMergeBeforeMerge Event (Publisher)

 Copy code hover
[image]

Application.MailMergeBeforeMerge Event (Publisher)
See also Send feedback

Occurs when a merge is executed before any records in a mail merge have merged.

Syntax

expression .MailMergeBeforeMerge(Doc, StartRecord, EndRecord, Cancel)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The mail merge main document.
StartRecord | Required | Long | The first record in the data source to include in the mail merge.
EndRecord | Required | Long | The last record in the data source to include in the mail merge.
Cancel | Required | Boolean | Stops the mail merge process before it starts.

Remarks

To access the Application object events, declare an Application object variable in the General Declarations section of a code module. Then set the variable equal to the Application object for which you want to access events. For information about using events with the Microsoft Publisher Application object, see Using Events with the Application Object.

Example

This example displays a message before the mail merge process begins, asking the user if they want to continue. If the user clicks No, the merge process is canceled.

Copy code Copy code
Private Sub MailMergeApp_MailMergeBeforeMerge(ByVal Doc As Document, _
 ByVal StartRecord As Long, ByVal EndRecord As Long, _
 Cancel As Boolean)

 Dim intVBAnswer As Integer

 Set Doc = ActiveDocument

 'Request whether the user wants to continue with the merge
 intVBAnswer = MsgBox("Mail Merge for " & Doc.Name & _
 " is now starting. Do you want to continue?", _
 vbYesNo, "Event!")

 'If user's response to question is No, then cancel merge process
 'and deliver a message to the user stating the merge is canceled
 If intVBAnswer = vbNo Then
 Cancel = True
 MsgBox "You have canceled mail merge for " & _
 Doc.Name & "."
 End If

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Columns.Parent Property (Publisher)

 Copy code hover
[image]

Columns.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a Columns object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


BorderArtFormat.Name Property (Publisher)

 Copy code hover
[image]

BorderArtFormat.Name Property (Publisher)
See also Send feedback

Returns or sets a String value indicating the name of the specified object. Read/write.

Syntax

expression .Name

expression A variable that represents a BorderArtFormat object.

Remarks

You can use an object's name in conjunction with the Item method or Item property to return a reference to the object if the Item method or property for the collection that contains the object takes a Variant argument. For example, if the value of the Name property for a shape is Rectangle 2, then .Shapes("Rectangle 2") will return a reference to that shape.

The Name property is the default property for the BorderArt, BorderArtFormat, and Label objects.

See also

Concepts

BorderArtFormat Object

Other resources

BorderArtFormat Object Members


MasterPages.Application Property (Publisher)

 Copy code hover
[image]

MasterPages.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a MasterPages object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Page.Move Method (Publisher)

 Copy code hover
[image]

Page.Move Method (Publisher)
Send feedback

Moves the specified page to the specified index in the Pages collection.

Syntax

expression .Move(Page, After)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | Long | The index number of the Pages collection where the specified page will be moved.
After | Optional | Boolean | True if the page will be inserted after the specified index number of the Pages collection specified by the Page parameter. Deafult is True.

Example

This example moves the first page of the publication before the third page of the publication. This example assumes that there are at least three pages in the document.

VBA Copy code Copy code
ActiveDocument.Pages(1).Move page:=3, After:=False


Font.Kerning Property (Publisher)

 Copy code hover
[image]

Font.Kerning Property (Publisher)
Send feedback

Returns or sets a Variant indicating the amount of horizontal spacing Microsoft Publisher applies to the characters in the text range. Read/write.

Syntax

expression .Kerning

expression A variable that represents a Font object.

Return Value

Variant

Remarks

When setting this property, numeric values are considered to be in points, and String values may be in any unit supported by Publisher. Return values are of type Single and in points. Negative values bring characters closer together than normal, and positive values spread characters farther apart than normal. The valid range is -600.0 to 600.0 points.

Use the InchesToPoints method to convert inches to points.

Example

This example adjusts the kerning of all text in the first story to 6 point.

Copy code Copy code
Application.ActiveDocument.Stories(1).TextRange.Font.Kerning = 6


Window.Width Property (Publisher)

 Copy code hover
[image]

Window.Width Property (Publisher)
Send feedback

Returns or sets a Long that represents the width (in points) of the window. Read/write.

Syntax

expression .Width

expression A variable that represents a Window object.

Example

This example sets the height and width of the active window if the window is neither maximized nor minimized.

VBA Copy code Copy code
Sub SetWindowHeight()
 With ActiveWindow
 If .WindowState = pbWindowStateNormal Then
 .Height = InchesToPoints(5)
 .Width = InchesToPoints(5)
 End If
 End With
End Sub


Page.YOffsetWithinReaderSpread Property (Publisher)

 Copy code hover
[image]

Page.YOffsetWithinReaderSpread Property (Publisher)
Send feedback

Returns a Single that represents the distance (in points) from the top edge of the reader spread to the top edge of the page. Read-only.

Syntax

expression .YOffsetWithinReaderSpread

expression A variable that represents a Page object.

Return Value

Single

Example

This example creates a shape on the second and third pages of the active publication and then sets the position of the shape on the third page to the diagonally opposite corner of the page from the shape on the second page. For this example to work, the active publication must have at least three pages.

VBA Copy code Copy code
Sub OffsetShapePositions()
 Dim shpOne As Shape
 Dim intLeft As Integer
 Dim intTop As Integer
 Dim intWidth As Integer
 Dim intHeight As Integer

 With ActiveDocument
 .ViewTwoPageSpread = True

 With .Pages
 intWidth = 150
 intHeight = 150
 intLeft = (.Item(2).Width / 2) - intWidth
 intTop = InchesToPoints(7)

 Set shpOne = .Item(2).Shapes.AddShape _
 (Type:=msoShape5pointStar, Left:=intLeft, _
 Top:=intTop, Width:=intWidth, Height:=intHeight)

 intLeft = (.Item(3).XOffsetWithinReaderSpread - _
 .Item(2).XOffsetWithinReaderSpread) + (.Item(2) _
 .Width - shpOne.Left - shpOne.Width)
 intTop = (.Item(3).YOffsetWithinReaderSpread - _
 .Item(2).YOffsetWithinReaderSpread) + (.Item(2) _
 .Height - shpOne.Top - shpOne.Height)

 .Item(2).Shapes.AddShape Type:=msoShape5pointStar, _
 Left:=intLeft, Top:=intTop, Width:=intWidth, _
 Height:=intHeight
 End With
 End With
End Sub


Document.ScratchArea Property (Publisher)

 Copy code hover
[image]

Document.ScratchArea Property (Publisher)
Send feedback

Returns a ScratchArea object for an a given document.

Syntax

expression .ScratchArea

expression A variable that represents a Document object.

Return Value

ScratchArea

Remarks

The ScratchArea object is a collection of objects on the scratch page. The ScratchArea object is not in the Pages collection because it is fundamentally not a page; its only similarity to a page is that it can contain objects.

Example

This example sets the variable object as the first shape on the scratch area of the active document.

VBA Copy code Copy code
Sub ScratchPad()

 Dim saPage As ScratchArea
 Dim objFirst As Object

 saPage = Application.ActiveDocument.ScratchArea
 objFirst = saPage.Shapes(1)

End Sub


Hyperlink.Address Property (Publisher)

 Copy code hover
[image]

Hyperlink.Address Property (Publisher)
Send feedback

Returns or sets a String that represents the URL address for a hyperlink. Read/write.

Syntax

expression .Address

expression A variable that represents a Hyperlink object.

Return Value

String

Example

This example displays the URL addresses for all hyperlinks in the active publication.

Copy code Copy code
Sub ShowHyperlinkAddresses()
 Dim pgsPage As Page
 Dim shpShape As Shape
 Dim hprLink As Hyperlink
 Dim intCount As Integer
 For Each pgsPage In ActiveDocument.Pages
 For Each shpShape In pgsPage.Shapes
 If shpShape.TextFrame.TextRange.Hyperlinks.Count > 0 Then
 For Each hprLink In shpShape.TextFrame.TextRange.Hyperlinks
 MsgBox "This hyperlink goes to " & hprLink.Address & "."
 intCount = intCount + 1
 Next hprLink
 ElseIf shpShape.Hyperlink.Address <> "" Then
 MsgBox "This hyperlink goes to " & shpShape.Hyperlink.Address & "."
 intCount = intCount + 1
 End If
 Next shpShape
 Next pgsPage
 If intCount < 1 Then
 MsgBox "You don't have any hyperlinks in your publication."
 Else
 MsgBox "You have " & intCount & " hyperlinks in " & ThisDocument.Name & "."
 End If
End Sub


Rows.Count Property (Publisher)

 Copy code hover
[image]

Rows.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a Rows object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


ShapeRange.Tags Property (Publisher)

 Copy code hover
[image]

ShapeRange.Tags Property (Publisher)
Send feedback

Returns a Tags collection representing tags or custom properties applied to a shape, shape range, page, or publication.

Syntax

expression .Tags

expression A variable that represents a ShapeRange object.

Example

This example adds a tag to each oval shape on the first page of the active publication.

Copy code Copy code
Dim shp As Shape
Dim tagsAll As Tags
Dim tagLoop As Tag
Dim blnTag As Boolean

With ActiveDocument.Pages(1)
 For Each shp In .Shapes
 If shp.AutoShapeType = msoShapeOval Then
 Set tagsAll = shp.Tags
 blnTag = False

 For Each tagLoop In tagsAll
 If tagLoop.Name = "Shape" Then
 blnTag = True
 Exit For
 End If
 Next tagLoop

 If blnTag = False Then
 tagsAll.Add Name:="Shape", Value:="Oval"
 End If
 End If
 Next shp
End With


Cell.VerticalTextAlignment Property (Publisher)

 Copy code hover
[image]

Cell.VerticalTextAlignment Property (Publisher)
Send feedback

Returns or sets a PbVerticalTextAlignmentType constant that represents the vertical alignment of text in a text box. Read/write.

Syntax

expression .VerticalTextAlignment

expression A variable that represents a Cell object.

Remarks

The VerticalTextAlignment property value can be one of these PbVerticalTextAlignmentType constants.

pbVerticalTextAlignmentBottom

pbVerticalTextAlignmentCenter

pbVerticalTextAlignmentTop

Example

This example vertically centers the text in the specified text frame. This example assumes there is at least one shape on the first page of the active publication.

VBA Copy code Copy code
Sub SetVerticalAlignment()
 ActiveDocument.Pages(1).Shapes(1).TextFrame _
 .VerticalTextAlignment = pbVerticalTextAlignmentCenter
End Sub


CaptionStyles Methods (Publisher)

 Copy code hover
[image]

CaptionStyles Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Item | Returns the specified CaptionStyle object from a CaptionStyles collection. Read-only.


Shape.LinkFormat Property (Publisher)

 Copy code hover
[image]

Shape.LinkFormat Property (Publisher)
Send feedback

Returns a LinkFormat object that contains the properties that are unique to linked OLE objects. Read-only.

Syntax

expression .LinkFormat

expression A variable that represents a Shape object.

Example

This example updates the links between any OLE objects on page one in the active publication and their source files.

Copy code Copy code
Dim sh As Shape

For Each sh In ActiveDocument.Pages(1).Shapes
 If sh.Type = pbLinkedOLEObject Then
 With sh.LinkFormat
 .Update
 End With
 End If
Next


PbTableDirectionType Enumeration (Publisher)

 Copy code hover
[image]

PbTableDirectionType Enumeration (Publisher)
Send feedback

Represents whether text in a table is read from left to right or from right to left.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbTableDirectionLeftToRight | 1 | Left to Right
pbTableDirectionRightToLeft | 2 | Right to Left


CaptionStyles Properties (Publisher)

 Copy code hover
[image]

CaptionStyles Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Microsoft Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns a Long that represents the number of items in the specified collection. Read-only.
Parent | Returns the parent of the CaptionStyles collection. Read-only.


RulerGuide.Delete Method (Publisher)

 Copy code hover
[image]

RulerGuide.Delete Method (Publisher)
Send feedback

Deletes the specified object.

Syntax

expression .Delete

expression A variable that represents a RulerGuide object.

Remarks

A run-time error occurs if the specified object does not exist.


Font.TrackingPreset Property (Publisher)

 Copy code hover
[image]

Font.TrackingPreset Property (Publisher)
Send feedback

Returns or sets a PbTrackingPresetType constant representing the preset tracking type for characters in the specified font in a text range. Read/write.

Syntax

expression .TrackingPreset

expression A variable that represents a Font object.

Return Value

PbTrackingPresetType

Remarks

The TrackingPreset property value can be one of these PbTrackingPresetType constants.

pbTrackingCustom

pbTrackingLoose

pbTrackingMixed

pbTrackingNormal

pbTrackingTight

pbTrackingVeryLoose

pbTrackingVeryTight

Loose and very loose tracking leaves ample space between characters, whereas tight and very tight tracking can produce character overlap.

Example

This example specifies tight tracking as the preset for the characters in the second story.

VBA Copy code Copy code
Sub TrackingType()

 Application.ActiveDocument.Stories(2).TextRange _
 .Font.TrackingPreset = pbTrackingTight

End Sub


MailMergeDataSource.DataFields Property (Publisher)

 Copy code hover
[image]

MailMergeDataSource.DataFields Property (Publisher)
Send feedback

Returns a MailMergeDataFields collection that represents the fields in the specified data source.

Syntax

expression .DataFields

expression A variable that represents a MailMergeDataSource object.

Return Value

MailMergeDataFields

Example

This example displays the value of the value of the FirstName and LastName fields from the active record in the data source attached to the active publication.

Copy code Copy code
Sub ShowNameForActiveRecord()
 Dim mdfFirst As MailMergeDataField
 Dim mdfLast As MailMergeDataField

 With ActiveDocument.MailMerge.DataSource
 Set mdfFirst = .DataFields.Item("FirstName")
 Set mdfLast = .DataFields.Item("LastName")
 MsgBox "The active record in the attached " & _
 vbLf & "data source is : " & _
 mdfFirst.Value & " " & _
 mdfLast.Value
 End With
End Sub


Options.AutoHyphenate Property (Publisher)

 Copy code hover
[image]

Options.AutoHyphenate Property (Publisher)
Send feedback

True (default) for Microsoft Publisher to automatically hyphenate text in text frames. Read/write Boolean.

Syntax

expression .AutoHyphenate

expression A variable that represents an Options object.

Return Value

Boolean

Example

This example turns on automatic hyphenation for Publisher and sets the amount of space from the right margin to use when hyphenating words to one inch (72 points).

Copy code Copy code
Sub SetHyphenationZone()
 With Options
 .AutoHyphenate = True
 .HyphenationZone = 72
 End With
End Sub


TextRange.Story Property (Publisher)

 Copy code hover
[image]

TextRange.Story Property (Publisher)
Send feedback

Returns a Story object that represents the story properties in a text range.

Syntax

expression .Story

expression A variable that represents a TextRange object.

Example

This example returns the story in the selected text range and, if it is in a text frame, inserts text into the text range.

Copy code Copy code
Sub AddTextToStory()
 With Selection.TextRange.Story
 If .HasTextFrame Then
 .TextRange.InsertAfter NewText:=vbLf & "This is a test."
 End If
 End With
End Sub


WizardProperties.Count Property (Publisher)

 Copy code hover
[image]

WizardProperties.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a WizardProperties object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


Documents Object (Publisher)

 Copy code hover
[image]

Documents Object (Publisher)
Send feedback

Represents all open publications. The Documents collection contains all Document objects that are open in Microsoft Publisher.

Example

Use the Documents property to return the Documents collection. The following example lists all of the open publications.

Copy code Copy code
Dim objDocument As Document
Dim strMsg As String
For Each objDocument In Documents
 strMsg = strMsg & objDocument.Name & vbCrLf
Next objDocument
MsgBox Prompt:=strMsg, Title:="Current Documents Open", Buttons:=vbOKOnly

Use the Add method to add a new document to the collection. A new and visible instance of Publisher is created when the Add method is called. The following example adds a new document to the Documents collection.

Copy code Copy code
Dim objDocument As Document
Set objDocument = Documents.Add
With objDocument
 .LayoutGuides.Columns = 4
 .LayoutGuides.Rows = 9
 .ActiveView.Zoom = pbZoomWholePage
End With

Use the Item(index) property, where index is the index number or document name as a String, to return a specific document object. The following example displays the name of the first open publication.

Copy code Copy code
If Documents.Count >= 1 Then
 MsgBox Documents.Item(1).Name
End If

The following example checks the name of each document in the Documents collection. If the name of a document is "sales.doc", an object variable objSalesDoc is set to that document in the Documents collection.

Copy code Copy code
Dim objDocument As Document
Dim objSalesDoc As Document
For Each objDocument In Documents
 If objDocument.Name = "sales.pub" Then
 Set objSalesDoc = objDocument
 End If
Next objDocument


CalloutFormat.CustomLength Method (Publisher)

 Copy code hover
[image]

CalloutFormat.CustomLength Method (Publisher)
Send feedback

Specifies that the first segment of the callout line (the segment attached to the text callout box) retain a fixed length whenever the callout is moved.

Syntax

expression .CustomLength(Length)

expression A variable that represents a CalloutFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Length | Required | Variant | The length of the first segment of the callout. Numeric values are evaluated in points; strings can be in any unit supported by Microsoft Publisher (for example, "2.5 in").

Remarks

Applying this method sets the AutoLength property to False and sets the Length property to the value specified for the Length argument.

Use the AutomaticLength method to specify that the first segment of the callout line be scaled automatically whenever the callout is moved. Applies only to callouts whose lines consist of more than one segment (types msoCalloutThree and msoCalloutFour).

Example

This example switches between an automatically-scaling first segment and one with a fixed length for the callout line for the first shape in the active publication. For the example to work, this shape must be a callout.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes(1).Callout
 If .AutoLength Then
 .CustomLength Length:=50
 Else
 .AutomaticLength
 End If
End With


CalloutFormat.Length Property (Publisher)

 Copy code hover
[image]

CalloutFormat.Length Property (Publisher)
Send feedback

Returns a Variant indicating the length (in points) of the first segment of the callout line (the segment attached to the text callout box) if the AutoLength property of the specified callout is set to False. Otherwise, an error occurs. Read-only.

Syntax

expression .Length

expression A variable that represents a CalloutFormat object.

Remarks

This property applies only to callouts whose lines consist of more than one segment (types msoCalloutThree and msoCalloutFour).

Use the CustomLength method to set the value of this property.

Example

If the first line segment in the callout named co1 has a fixed length, this example specifies that the length of the first line segment in the callout named co2 will also be fixed at that length. For the example to work, both callouts must have multiple-segment lines.

VBA Copy code Copy code
Dim len1 As Single

With ActiveDocument.Pages(1).Shapes
 With .Item("co1").Callout
 If Not .AutoLength Then len1 = .Length
 End With
 If len1 Then .Item("co2").Callout _
 .CustomLength Length:=len1
End With


ShapeNodes.Item Method (Publisher)

 Copy code hover
[image]

ShapeNodes.Item Method (Publisher)
Send feedback

Returns an individual object in a specified collection.

Syntax

expression .Item(Index)

expression A variable that represents a ShapeNodes object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The number or name of the field or list box item to return.

Return Value

ShapeNode


Shapes.AddCurve Method (Publisher)

 Copy code hover
[image]

Shapes.AddCurve Method (Publisher)
Send feedback

Adds a new Shape object representing a Bézier curve to the specified Shapes collection.

Syntax

expression .AddCurve(SafeArrayOfPoints)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
SafeArrayOfPoints | Required | Variant | An array of coordinate pairs that specifies the vertices and control points of the curve. The first point you specify is the starting vertex, and the next two points are control points for the first Bézier segment. Then, for each additional segment of the curve, you specify a vertex and two control points. The last point you specify is the ending vertex for the curve. Note that you must always specify 3n + 1 points, where n is the number of segments in the curve.

Return Value

Shape

Remarks

For the array elements in SafeArrayOfPoints, numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

Example

The following example adds a two-segment Bézier curve to the first page of the active publication.

Copy code Copy code
Dim shpCurve As Shape
Dim arrPoints(1 To 4, 1 To 2) As Single

arrPoints(1, 1) = 0
arrPoints(1, 2) = 0
arrPoints(2, 1) = 72
arrPoints(2, 2) = 72
arrPoints(3, 1) = 144
arrPoints(3, 2) = 36
arrPoints(4, 1) = 216
arrPoints(4, 2) = 108

Set shpCurve = ActiveDocument.Pages(1).Shapes.AddCurve _
 (SafeArrayOfPoints:=arrPoints)


CatalogMergeShapes.Item Method (Publisher)

 Copy code hover
[image]

CatalogMergeShapes.Item Method (Publisher)
Send feedback

Returns an individual object in a specified collection.

Syntax

expression .Item(Index)

expression A variable that represents a CatalogMergeShapes object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The number or name of the field or list box item to return.

Return Value

Shape


Cell.Width Property (Publisher)

 Copy code hover
[image]

Cell.Width Property (Publisher)
Send feedback

Returns a Long that represent the width (in cells) of a table, range of cells, or page. Read-only.

Syntax

expression .Width

expression A variable that represents a Cell object.


TextRange.Paragraphs Method (Publisher)

 Copy code hover
[image]

TextRange.Paragraphs Method (Publisher)
Send feedback

Returns a TextRange object that represents the specified paragraphs.

Syntax

expression .Paragraphs(Start, Length)

expression A variable that represents a TextRange object.

Parameters

Name | Required/Optional | Data Type | Description
Start | Required | Long | The first paragraph in the returned range.
Length | Optional | Long | The number of paragraphs to be returned. Default is 1.

Return Value

TextRange

Example

If Length is omitted, the returned range contains one paragraph.

If Length is greater than the number of paragraphs from the specified starting paragraph to the end of the text, the returned range contains all those paragraphs.

This example formats as indents the first line of the selected paragraph.

Copy code Copy code
Sub FormatCurrentParagraph()
 Selection.TextRange.Paragraphs(Start:=1).ParagraphFormat _
 .FirstLineIndent = InchesToPoints(0.5)
End Sub


DropCap.ApplyCustomDropCap Method (Publisher)

 Copy code hover
[image]

DropCap.ApplyCustomDropCap Method (Publisher)
Send feedback

Applies custom formatting to the first letters of paragraphs in a text frame.

Syntax

expression .ApplyCustomDropCap(LinesUp, Size, Span, FontName, Bold, Italic)

expression A variable that represents a DropCap object.

Parameters

Name | Required/Optional | Data Type | Description
LinesUp | Optional | Long | The number of lines to move up the drop cap. The default is 0. The maximum number cannot be more than the number entered for the Size argument less one.
Size | Optional | Long | The size of the drop cap letters in number of lines high. The default is 5.
Span | Optional | Long | The number of letters included in the drop cap. The default is 1.
FontName | Optional | String | The name of the font to format the drop cap. The default is the current font.
Bold | Optional | Boolean | True to bold the drop cap. The default is False.
Italic | Optional | Boolean | True to italicize the drop cap. The default is False.

Example

This example formats the first three letters of the paragraphs in the specified text box.

Copy code Copy code
Sub CustDropCap()

 ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange.DropCap _
 .ApplyCustomDropCap LinesUp:=1, Size:=6, Span:=3, _
 FontName:="Script MT Bold", Bold:=True, Italic:=True

End Sub


TextFrame.HasNextLink Property (Publisher)

 Copy code hover
[image]

TextFrame.HasNextLink Property (Publisher)
Send feedback

Indicates whether the specified text frame has a valid forward text-box link. Read-only.

Syntax

expression .HasNextLink

expression A variable that represents a TextFrame object.

Return Value

MsoTriState

Remarks

The HasNextLink property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The specified text frame does not have a forward text-box link.
msoTrue | The specified text frame has a forward text-box link.

Example

This example breaks all links in the document to the first specified text frame if links exist. This example assumes that there is at least one shape on the first page of the active publication.

VBA Copy code Copy code
Sub AddPreviousNextLinkPages()
 With ActiveDocument.Pages(1).Shapes(1).TextFrame
 If .HasNextLink Then .BreakForwardLink
 If .HasPreviousLink Then .PreviousLinkedTextFrame _
 .BreakForwardLink
 End With
End Sub


PictureFormat.TransparencyColor Property (Publisher)

 Copy code hover
[image]

PictureFormat.TransparencyColor Property (Publisher)
Send feedback

Returns or sets an MsoRGBType constant that represents the transparency color. Read/write.

Syntax

expression .TransparencyColor

expression A variable that represents a PictureFormat object.

Return Value

MsoRGBType

Example

This example creates a picture on the first page and sets the transparency color to black.

VBA Copy code Copy code
Sub SetTransparentColor()
 With ActiveDocument.Pages(1).Shapes.AddPicture( _
 FileName:="C:\My Pictures\Sample.gif", LinkToFile:=msoFalse, _
 SaveWithDocument:=msoTrue, Left:=36, Top:=36)
 .PictureFormat.TransparencyColor = RGB(Red:=255, Green:=255, Blue:=255)
 End With
End Sub


Shape.WizardTagInstance Property (Publisher)

 Copy code hover
[image]

Shape.WizardTagInstance Property (Publisher)
Send feedback

Returns or sets a Long indicating the instance of the specified shape compared with other shapes having the same wizard tag. Read/write.

Syntax

expression .WizardTagInstance

expression A variable that represents a Shape object.

Remarks

The combination of the WizardTagInstance property and the WizardTag property uniquely defines every shape in a publication.

Example

The following example displays the wizard tag and wizard tag instance information for all the shapes on page one of the active publication.

Copy code Copy code
Dim shpLoop As Shape

For Each shpLoop In ActiveDocument.Pages(1).Shapes
 With shpLoop
 Debug.Print "Shape: " & .Name
 Debug.Print " Wizard tag: " & .WizardTag
 Debug.Print " Wizard tag instance: " _
 & .WizardTagInstance
 End With
Next shpLoop


Page.Parent Property (Publisher)

 Copy code hover
[image]

Page.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a Page object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


PictureFormat.IncrementBrightness Method (Publisher)

 Copy code hover
[image]

PictureFormat.IncrementBrightness Method (Publisher)
Send feedback

Changes the brightness of the picture by the specified amount.

Syntax

expression .IncrementBrightness(Increment)

expression A variable that represents a PictureFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how much to change the value of the Brightness property for the picture. A positive value makes the picture brighter; a negative value makes the picture darker. Valid values are between - 1 and 1.

Remarks

You cannot adjust the brightness of a picture past the upper or lower limit for the Brightness property. For example, if the Brightness property is initially set to 0.9 and you specify 0.3 for the Increment argument, the resulting brightness level will be 1.0, which is the upper limit for the Brightness property, instead of 1.2.

Use the Brightness property to set the absolute brightness of the picture.

Example

This example creates a duplicate of the first shape in the active publication and then moves and darkens the duplicate. For the example to work, the shape must be either a picture or an OLE object representing a picture.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes(1).Duplicate
 .PictureFormat.IncrementBrightness Increment:=-0.2
 .IncrementLeft Increment:=50
 .IncrementTop Increment:=50
End With


PbInlineAlignment Enumeration (Publisher)

 Copy code hover
[image]

PbInlineAlignment Enumeration (Publisher)
Send feedback

Indicates whether an inline shape has left, right, or in-text alignment.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbInlineAlignmentCharacter | 0 | Shape is aligned with the text characters.
pbInlineAlignmentLeft | 1 | Shape is left-aligned.
pbInlineAlignmentMixed | -2 | Shape is mixed-aligned.
pbInlineAlignmentRight | 2 | Shape is right-aligned.


ConnectorFormat Properties (Publisher)

 Copy code hover
[image]

ConnectorFormat Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
BeginConnected | Returns an MsoTriState constant indicating whether the beginning of the specified connector is connected to a shape. Read-only.
BeginConnectedShape | Returns a Shape object that represents the shape to which the beginning of the specified connector is attached.
BeginConnectionSite | Returns a Long indicating the connection site to which the beginning of a connector is connected. Read-only.
EndConnected | Returns an MsoTriState constant indicating whether the end of the specified connector is connected to a shape. Read-only.
EndConnectedShape | Returns a Shape object that represents the shape to which the end of the specified connector is attached.
EndConnectionSite | Returns a Long indicating the connection site to which the end of a connector is connected. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Type | Returns or sets an MsoConnectorType constant that represents the connector type. Read/write.


LayoutGuides.Columns Property (Publisher)

 Copy code hover
[image]

LayoutGuides.Columns Property (Publisher)
Send feedback

Returns or sets a Long that represents the number of guide columns on a page or the number of columns in a text frame. Read/write.

Syntax

expression .Columns

expression A variable that represents a LayoutGuides object.


View.Parent Property (Publisher)

 Copy code hover
[image]

View.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a View object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Attachment.Delete Method (Publisher)

 Copy code hover
[image]

Attachment.Delete Method (Publisher)
See also Send feedback

Deletes an Attachment object from the Attachments collection of an e-mail merge message.

Version Information

Version Added: Publisher 2007

Syntax

expression .Delete

expression A variable that represents an Attachment object.

Remarks

The Delete method performs an irreversible operation on the Attachments collection. It calls IUnknown.Release on the collection's reference to the Attachment object. If you have another reference to the attachment, you can still access its properties and methods, but you can never again associate it with any collection, because the Add method always creates a new object. Use the Set keyword to set your reference variable either to Nothing or to another attachment.

The final release of the Attachment object takes place when you assign your reference variable to Nothing, or when you call Delete, if you had no other reference. At this point the object is removed from memory. Attempting to gain access to a released object returns the Microsoft Collaboration Data Object error CdoE_INVALID_OBJECT.

When you delete a member of a collection, the collection is immediately refreshed, meaning that its Count property is reduced by one and its members are reindexed. To access the member that previously followed the deleted member in the collection, you must use its new index value.

To delete all attachments to the current e-mail merge message, use the ClearAll method of the Attachments collection.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to delete an attachment to the message in an e-mail merge. The code deletes the attachment at the first index position in the Attachments collection and then prints the name of the deleted attachment and the number of current attachments to the message in the Immediate window.

Before running this code, ensure that there is at least one attachment to the current e-mail merge message.

VBA Copy code Copy code
Public Sub Delete_Example()

 Dim pubAttachments As Publisher.Attachments
 Dim pubAttachment As Publisher.Attachment

 Dim pubMailMerge As Publisher.MailMerge
 Dim pubEmailMergeEnvelope As Publisher.EmailMergeEnvelope

 Set pubMailMerge = ThisDocument.MailMerge
 Set pubEmailMergeEnvelope = pubMailMerge.EmailMergeEnvelope
 Set pubAttachments = pubEmailMergeEnvelope.Attachemts

 Set pubAttachment = pubAttachments(1)
 Debug.Print pubAttachments.Count
 Debug.Print pubAttachment.Name

 pubAttachment.Delete

End Sub

See also

Concepts

Attachment Object

Other resources

Attachment Object Members


Application.EmusToPoints Method (Publisher)

 Copy code hover
[image]

Application.EmusToPoints Method (Publisher)
See also Send feedback

Converts a measurement from emus to points (12700 emus = 1 point). Returns the converted measurement as a Single.

Syntax

expression .EmusToPoints(Value)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Value | Required | Single | An expression that returns one of the objects in the Applies To list.

Return Value

Single

Remarks

Use the PointsToEmus method to convert measurements in points to emus.

Example

This example converts measurements in emus entered by the user to measurements in points.

Copy code Copy code
Dim strInput As String
Dim strOutput As String

Do While True
 ' Get input from user.
 strInput = InputBox( _
 Prompt:="Enter measurement in emus (0 to cancel): ", _
 Default:="0")

 ' Exit the loop if user enters zero.
 If Val(strInput) = 0 Then Exit Do

 ' Evaluate and display result.
 strOutput = Trim(strInput) & " emus = " _
 & Format(Application _
 .EmusToPoints(Value:=Val(strInput)), _
 "0.00") & " points"

 MsgBox strOutput
Loop

See also

Concepts

Application Object

Other resources

Application Object Members


TextFrame.PreviousLinkedTextFrame Property (Publisher)

 Copy code hover
[image]

TextFrame.PreviousLinkedTextFrame Property (Publisher)
Send feedback

Returns a TextFrame object representing the text frame from which text flows to the specified text frame.

Syntax

expression .PreviousLinkedTextFrame

expression A variable that represents a TextFrame object.

Return Value

TextFrame

Remarks

If the specified text frame is not part of a chain of linked frames or is the first in a chain of linked frames, this property returns nothing.

Example

The following example returns the previously linked text frame of shape three on page one of the active publication and sets its font to Times New Roman.

VBA Copy code Copy code
Dim txtFrame As TextFrame

Set txtFrame = ActiveDocument.Pages(1) _
 .Shapes(3).TextFrame.PreviousLinkedTextFrame

txtFrame.TextRange.Font = "Times New Roman"


PbOrientationType Enumeration (Publisher)

 Copy code hover
[image]

PbOrientationType Enumeration (Publisher)
Send feedback

Represents the orientation used to print envelopes.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbOrientationLandscape | 2 | Landscape orientation
pbOrientationPortrait | 1 | Portrait orientation


CaptionStyles Members (Publisher)

 Copy code hover
[image]

CaptionStyles Members (Publisher)
Send feedback

Represents the collection of all 37 of the CaptionStyle objects available in Microsoft Publisher 2010.

Methods

Name | Description
Item | Returns the specified CaptionStyle object from a CaptionStyles collection. Read-only.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Microsoft Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns a Long that represents the number of items in the specified collection. Read-only.
Parent | Returns the parent of the CaptionStyles collection. Read-only.


LineFormat.InsetPen Property (Publisher)

 Copy code hover
[image]

LineFormat.InsetPen Property (Publisher)
Send feedback

Returns or sets an MsoTriState constant indicating whether a specified shape's lines are drawn inside its boundaries. Read/write.

Syntax

expression .InsetPen

expression A variable that represents an LineFormat object.

Return Value

MsoTriState

Remarks

An error occurs if you attempt to set this property to msoTrue for any Microsoft Office AutoShape that does not support inset pen drawing.

The value of the InsetPen property for tables is always msoTrue; attempting to set the property to any other value results in an error.

The InsetPen property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | Lines are drawn directly on the specified shape's boundaries.
msoTriStateMixed | Return value indicating a combination of msoTrue and msoFalse for the specified shape range.
msoTriStateToggle | Set value that switches between msoTrue and msoFalse.
msoTrue | Lines are drawn inside the specified shape's boundaries.

Example

The following example adds two rectangles to page one of the active publication, the first with its lines drawn inside its boundaries, and the second with its lines drawn on its boundaries.

VBA Copy code Copy code
Dim shpNew As Shape

With ActiveDocument.Pages(1).Shapes
 Set shpNew = .AddShape(Type:=msoShapeRectangle, _
 Left:=200, Top:=150, Width:=150, Height:=100)
 With shpNew.Line
 .Weight = 24
 .InsetPen = msoTrue
 End With

 Set shpNew = .AddShape(Type:=msoShapeRectangle, _
 Left:=200, Top:=300, Width:=150, Height:=100)
 With shpNew.Line
 .Weight = 24
 .InsetPen = msoFalse
 End With
End With


ShapeRange.Cut Method (Publisher)

 Copy code hover
[image]

ShapeRange.Cut Method (Publisher)
Send feedback

Deletes the specified object and places it on the Clipboard.

Syntax

expression .Cut

expression A variable that represents a ShapeRange object.

Remarks

Use the Paste method to paste the contents of the Clipboard.

The Copy method can be used on Shape objects, but the Paste method cannot.

Example

This example deletes shape one and shape two from page one of the active publication, places copies of them on the Clipboard, and then pastes the copies onto page two.

Copy code Copy code
With ActiveDocument
 .Pages(1).Shapes.Range(Array(1, 2)).Cut
 .Pages(2).Shapes.Paste
End With

This example deletes shape one on page one of the active publication and places a copy of it on the Clipboard.

Copy code Copy code
ActiveDocument
Copy code Copy code
.Pages(1).Shapes(1).Cut

This example deletes the text in shape one on page one of the active publication and places a copy of it on the Clipboard.

Copy code Copy code
ActiveDocument
Copy code Copy code
.Pages(1).Shapes(1).TextFrame.TextRange.Cut


FillFormat.PresetTextured Method (Publisher)

 Copy code hover
[image]

FillFormat.PresetTextured Method (Publisher)
Send feedback

Sets the specified fill to a preset texture.

Syntax

expression .PresetTextured(PresetTexture)

expression A variable that represents a FillFormat object.

Parameters

Name | Required/Optional | Data Type | Description
PresetTexture | Required | MsoPresetTexture | The preset texture.

Remarks

The PresetTexture parameter can be one of the following MsoPresetTexture constants declared in the Microsoft Office type library.

msoTextureBlueTissuePaper

msoTextureBouquet

msoTextureBrownMarble

msoTextureCanvas

msoTextureCork

msoTextureDenim

msoTextureFishFossil

msoTextureGranite

msoTextureGreenMarble

msoTextureMediumWood

msoTextureNewsprint

msoTextureOak

msoTexturePaperBag

msoTexturePapyrus

msoTextureParchment

msoTexturePinkTissuePaper

msoTexturePurpleMesh

msoTextureRecycledPaper

msoTextureSand

msoTextureStationery

msoTextureWalnut

msoTextureWaterDroplets

msoTextureWhiteMarble

msoTextureWovenMat

Example

This example adds a rectangle with a green-marble textured fill to the active publication.

VBA Copy code Copy code
ActiveDocument.Pages(1).Shapes _
 .AddShape(Type:=msoShapeCan, _
 Left:=90, Top:=90, Width:=40, Height:=80) _
 .Fill.PresetTextured _
 PresetTexture:=msoTextureGreenMarble


View.ZoomIn Method (Publisher)

 Copy code hover
[image]

View.ZoomIn Method (Publisher)
Send feedback

Increases the magnification of the specified view.

Syntax

expression .ZoomIn

expression A variable that represents a View object.

Example

This example increases the magnification of the active view.

Copy code Copy code
Sub Zoom()
 ActiveView.ZoomIn
End Sub


ConnectorFormat.Application Property (Publisher)

 Copy code hover
[image]

ConnectorFormat.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a ConnectorFormat object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Shape.Hyperlink Property (Publisher)

 Copy code hover
[image]

Shape.Hyperlink Property (Publisher)
Send feedback

Returns a Hyperlink object representing the hyperlink associated with the specified shape.

Syntax

expression .Hyperlink

expression A variable that represents a Shape object.

Example

This example sets shape one on page one in the active publication to jump to the specified Web site when the shape is clicked.

Copy code Copy code
Dim hypTemp As Hyperlink

Set hypTemp = ActiveDocument.Pages(1).Shapes(1).Hyperlink

hypTemp.Address = "http://www.tailspintoys.com/"


Font Object (Publisher)

 Copy code hover
[image]

Font Object (Publisher)
Send feedback

Contains font attributes (font name, font size, color, and so on) for an object.

Example

Use the Font property to return the Font object. The following instruction applies bold formatting to the selection.

Copy code Copy code
Sub BoldText()
 Selection.TextRange.Font.Bold = True
End Sub

The following example formats the first paragraph in the active publication as 24-point Arial and italic.

Copy code Copy code
Sub FormatText()
 Dim txtRange As TextRange
 Set txtRange = ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange
 With txtRange.Font
 .Bold = True
 .Name = "Arial"
 .Size = 24
 End With
End Sub

The following example changes the formatting of the Heading 2 style in the active publication to Arial and bold.

Copy code Copy code
Sub FormatStyle()
 With ActiveDocument.TextStyles("Normal").Font
 .Name = "Tahoma"
 .Italic = True
 .Size = 15
 End With
End Sub

You can also duplicate a Font object by using the Duplicate property. The following example creates a new character style with the character formatting from the selection in addition to italic formatting. The formatting of the selection is not changed.

Copy code Copy code
Sub DuplicateFont()
 Dim fntNew As Font
 Set fntNew = Selection.TextRange.Font.Duplicate
 fntNew.Italic = True
 ActiveDocument.TextStyles.Add(StyleName:="Italics").Font = fntNew
End Sub


Application.Options Property (Publisher)

 Copy code hover
[image]

Application.Options Property (Publisher)
See also Send feedback

Returns an Options object that represents application settings you can set in Microsoft Publisher.

Syntax

expression .Options

expression A variable that represents an Application object.

Return Value

Options

Example

This example disables background saves and then saves the active publication.

VBA Copy code Copy code
Sub SetGlobalSaveOptions()

 With Options
 .AllowBackgroundSave = False
 End With

 ActiveDocument.Save

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


TextRange.LanguageID Property (Publisher)

 Copy code hover
[image]

TextRange.LanguageID Property (Publisher)
Send feedback

Returns or sets a MsoLanguageID constant that represents the language for the specified object. Read/write.

Syntax

expression .LanguageID

expression A variable that represents a TextRange object.

Return Value

MsoLanguageID

Remarks

The LanguageID property value can be one of the MsoLanguageID constants declared in the Microsoft Office type library.

Example

This example formats the specified selection as French. This example assumes that the cursor is in a text box.

VBA Copy code Copy code
Sub SetLanguage()
 Selection.TextRange.LanguageID = msoLanguageIDFrench
End Sub


Options.ResetWizardSynchronizing Method (Publisher)

 Copy code hover
[image]

Options.ResetWizardSynchronizing Method (Publisher)
Send feedback

Resets the data that Microsoft Publisher uses to automatically change similar objects to have the same formatting or content.

Syntax

expression .ResetWizardSynchronizing

expression A variable that represents an Options object.

Remarks

Unexpected formatting changes may be a result of Publisher's object synchronization. Resetting the synchronization data will stop these changes.

Example

The following example resets the synchronization data that Publisher uses to give similar objects the same formatting.

Copy code Copy code
Options.ResetWizardSynchronizing


Tag Methods (Publisher)

 Copy code hover
[image]

Tag Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified object.


CatalogMergeShapes Object (Publisher)

 Copy code hover
[image]

CatalogMergeShapes Object (Publisher)
Send feedback

Represents the shapes contained in the catalog merge area of the specified publication.

Remarks

The catalog merge area is automatically resized to accommodate objects that are larger then the merge area, or that are positioned outside the catalog merge area when they are added.

Shapes inside the catalog merge area are automatically resized or repositioned if the catalog merge area is decreased in size or moved.

The catalog merge area can contain picture and text data fields you have inserted, in addtion to other design elements you choose.

Example

Use the CatalogMergeItems property of the Shape or ShapeRange objects to return the contents of the catalog merge area. The following example tests whether the specified publication contains a catalog merge area. If it does, it returns a list of the shapes it contains.

Copy code Copy code
Sub ListCatalogMergeAreaContents()

 Dim pgPage As Page
 Dim mmLoop As Shape
 Dim intCount As Integer

 For Each pgPage In ThisDocument.Pages
 For Each mmLoop In pgPage.Shapes

 If mmLoop.Type = pbCatalogMergeArea Then

 With mmLoop.CatalogMergeItems
 For intCount = 1 To .Count
 Debug.Print "Shape ID: " & _
 mmLoop.CatalogMergeItems.Item(intCount).ID
 Debug.Print "Shape Name: " & _
 mmLoop.CatalogMergeItems.Item(intCount).Name
 Next
 End With

 End If

 Next mmLoop
 Next pgPage

End Sub

Use the AddToCatalogMergeArea method of the Shape or ShapeRange objects to add shapes to a catalog merge area. The following example adds a rectangle to the catalog merge area in the specified publication. This example assumes a catalog merge area has been added to the first page of the publication.

Copy code Copy code
ThisDocument.Pages(1).Shapes.AddShape(1, 80, 75, 450, 125).AddToCatalogMergeArea

Use CatalogMergeItems(index), where index is index number, to return a single catalog merge area shape. The following example removes the first shape from the catalog merge area.

Copy code Copy code
ThisDocument.Pages(1).Shapes(1).CatalogMergeItems(1).RemoveFromCatalogMergeArea

Use the RemoveFromCatalogMergeArea method of the Shape or ShapeRange objects to remove shapes from a catalog merge area. Removed shapes are not deleted, but are instead placed on the publication page containing the catalog merge area. The following example tests whether the specified publication contains a catalog merge area. If it does, all the shapes are removed from the catalog merge area and deleted, and the catalog merge area is then removed from the publication.

Copy code Copy code
Sub DeleteCatalogMergeAreaAndAllShapesWithin()
 Dim pgPage As Page
 Dim mmLoop As Shape
 Dim intCount As Integer
 Dim strName As String

 For Each pgPage In ThisDocument.Pages
 For Each mmLoop In pgPage.Shapes

 If mmLoop.Type = pbCatalogMergeArea Then
 With mmLoop.CatalogMergeItems
 For intCount = .Count To 1 Step -1
 strName = mmLoop.CatalogMergeItems.Item(intCount).Name
 .Item(intCount).RemoveFromCatalogMergeArea
 pgPage.Shapes(strName).Delete
 Next
 End With
 mmLoop.RemoveCatalogMergeArea
 End If

 Next mmLoop
 Next pgPage

 End Sub


ShapeRange.SetShapesDefaultProperties Method (Publisher)

 Copy code hover
[image]

ShapeRange.SetShapesDefaultProperties Method (Publisher)
Send feedback

Applies the formatting for the specified shape or shape range to the default shape. Shapes created after this method has been used will have this formatting applied to them by default.

Syntax

expression .SetShapesDefaultProperties

expression A variable that represents a ShapeRange object.

Return Value

Nothing

Remarks

The SetShapesDefaultProperties method stores two different sets of default properties, one for a Shape object's AutoShapeType Property, and another for a TextFrame object. In other words, if this method is called on an AutoShape, the default formatting of that object will apply only to new AutoShapes, and will not apply to new text boxes. If this method is called on a text box, the default formatting of that object will apply only to new text boxes, and will not apply to new AutoShapes.

Example

This example adds a rectangle to the active publication, formats the rectangle's fill, applies the rectangle's formatting to the default shape, and then adds another smaller rectangle to the document. The second rectangle has the same fill as the first one.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes

 With .AddShape(Type:=msoShapeRectangle, _
 Left:=5, Top:=5, Width:=80, Height:=60)
 With .Fill
 .ForeColor.RGB = RGB(0, 0, 255)
 .BackColor.RGB = RGB(0, 204, 255)
 .Patterned Pattern:=msoPatternHorizontalBrick
 End With
 .SetShapesDefaultProperties
 End With

 .AddShape Type:=msoShapeRectangle, _
 Left:=90, Top:=90, Width:=40, Height:=30

End With


TextEffectFormat.KernedPairs Property (Publisher)

 Copy code hover
[image]

TextEffectFormat.KernedPairs Property (Publisher)
Send feedback

Sets or returns an MsoTriState constant that indicates whether character pairs in a WordArt object have been kerned. Read/write.

Syntax

expression .KernedPairs

expression A variable that represents a TextEffectFormat object.

Return Value

MsoTriState

Remarks

The KernedPairs property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | Character pairs in the specified WordArt object have not been kerned.
msoTriStateToggle | Switches between msoTrue and msoFalse.
msoTrue | Character pairs in the specified WordArt object have been kerned.

Example

This example turns on character pair kerning for all WordArt objects in the active publication.

VBA Copy code Copy code
Sub KernedWordArt()
 Dim pagPage As Page
 Dim shpShape As Shape
 For Each pagPage In ActiveDocument.Pages
 For Each shpShape In pagPage.Shapes
 If shpShape.Type = msoTextEffect Then
 shpShape.TextEffect.KernedPairs = msoTrue
 End If
 Next
 Next
End Sub


Document.ActiveView Property (Publisher)

 Copy code hover
[image]

Document.ActiveView Property (Publisher)
Send feedback

Returns a View object representing the view attributes for the specified document. Read-only.

Syntax

expression .ActiveView

expression A variable that represents a Document object.

Return Value

View

Example

The following example sets the active publication zoom to fill the screen.

Copy code Copy code
Sub SetActiveZoom()
 Dim viewTemp As View

 ActiveDocument.Pages(1).Shapes.AddShape 1, 10, 10, 50, 50
 Set viewTemp = ActiveDocument.ActiveView
 ActiveDocument.Pages(1).Shapes(1).Select
 viewTemp.Zoom = pbZoomFitSelection
End Sub


ShapeNode.Parent Property (Publisher)

 Copy code hover
[image]

ShapeNode.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a ShapeNode object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


PbBuildingBlockType Enumeration (Publisher)

 Copy code hover
[image]

PbBuildingBlockType Enumeration (Publisher)
Send feedback

Constants that represent building block types.

Version Information

Version Added: Publisher 2010

Name | Value | Description
pbBBBuiltIn | 1 | Built-in type
pbBBDownloaded | 2 | Downloaded type
pbBBNone | 0 | No type
pbBBUser | 3 | User-defined type
pbBBWorkgroup | 4 | Workgroup-defined type


LineFormat.PresetGradient Method (Publisher)

 Copy code hover
[image]

LineFormat.PresetGradient Method (Publisher)
Send feedback

Syntax

expression .PresetGradient(Style, Style, Variant, PresetGradientType)

expression A variable that represents a LineFormat object.

Parameters

Name | Required/Optional | Data type | Description
Style | Required | MSOGRADIENTSTYLE |
Variant | Required | INT |
PresetGradientType | Required | MSOPRESETGRADIENTTYPE |

Return Value

VOID


TextRange.Parent Property (Publisher)

 Copy code hover
[image]

TextRange.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a TextRange object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Document.Path Property (Publisher)

 Copy code hover
[image]

Document.Path Property (Publisher)
Send feedback

Returns a String indicating the full path to the file of the saved active publication, not including the last separator or file name.

Syntax

expression .Path

expression A variable that represents a Document object.

Remarks

The FullName property can be used to return both the path and file name.

Example

The following example demonstrates the differences between the Path, Name, and FullName properties. This example is best illustrated if the publication is saved in a folder other than the default.

Copy code Copy code
Sub PathNames()

 Dim strPath As String
 Dim strName As String
 Dim strFullName As String

 strPath = Application.ActiveDocument.Path
 strName = Application.ActiveDocument.Name
 strFullName = Application.ActiveDocument.FullName

 ' Note the file name & path differences
 ' while executing.
 MsgBox "The path is: " & strPath
 MsgBox "The file name is: " & strName
 MsgBox "The path & file name are: " & strFullName

End Sub


Printer.Index Property (Publisher)

 Copy code hover
[image]

Printer.Index Property (Publisher)
Send feedback

Returns a Long that represents the position of a particular printer in a specified printer collection.

Version Information

Version Added: Publisher 2007

Syntax

expression .Index

expression A variable that represents a Printer object.

Return Value

Long


ShapeRange.ZOrder Method (Publisher)

 Copy code hover
[image]

ShapeRange.ZOrder Method (Publisher)
Send feedback

Moves the specified shape in front of or behind other shapes in the collection (that is, changes the shape's position in the z-order).

Syntax

expression .ZOrder(ZOrderCmd)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
ZOrderCmd | Required | MsoZOrderCmd | Specifies where to move the specified shape relative to the other shapes.

Return Value

Nothing

Remarks

The ZOrderCmd parameter can be one of the MsoZOrderCmd constants declared in the Microsoft Office type library and shown in the following table.

msoBringForward

msoBringInFrontOfText

msoBringToFront

msoSendBackward

msoSendBehindText

msoSendToBack

Use the ZOrderPosition property to determine a shape's current position in the z-order.

Example

This example adds an oval to the active publication and then places the oval second from the back in the z-order if there is at least one other shape on the page.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes _
 .AddShape(Type:=msoShapeOval, _
 Left:=100, Top:=100, Width:=100, Height:=300)
 While .ZOrderPosition > 2
 .ZOrder ZOrderCmd:=msoSendBackward
 Wend
End With


Adjustments.Parent Property (Publisher)

 Copy code hover
[image]

Adjustments.Parent Property (Publisher)
See also Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents an Adjustments object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub

See also

Concepts

Adjustments Object

Other resources

Adjustments Object Members


PbListType Enumeration (Publisher)

 Copy code hover
[image]

PbListType Enumeration (Publisher)
Send feedback

Constants specifying the list type of a ParagraphFormat object, passed to the SetListType method.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbListTypeAiueo | 12 | Aiueo
pbListTypeArabic | 0 | Arabic
pbListTypeArabic1 | 46 | Arabic1
pbListTypeArabic2 | 48 | Arabic2
pbListTypeArabicLeadingZero | 22 | Arabic Leading Zero
pbListTypeBullet | 23 | Bullet
pbListTypeCardinalText | 6 | Cardinal Text
pbListTypeChnDbNum2 | 38 | ChnDbNum2
pbListTypeChnDbNum3 | 39 | ChnDbNum3
pbListTypeChosung | 25 | Chosung
pbListTypeCirclenum | 18 | Circle num
pbListTypeDAiueo | 20 | DAiueo
pbListTypeDbChar | 14 | DbChar
pbListTypeDbNum1 | 10 | DbNum1
pbListTypeDbNum2 | 11 | DbNum2
pbListTypeDbNum3 | 16 | DbNum3
pbListTypeDbNum4 | 17 | DbNum4
pbListTypeDIroha | 21 | DIroha
pbListTypeGanada | 24 | Ganada
pbListTypeHebrew1 | 45 | Hebrew1
pbListTypeHebrew2 | 47 | Hebrew2
pbListTypeHindi1 | 49 | Hindi1
pbListTypeHindi2 | 50 | Hindi2
pbListTypeHindi3 | 51 | Hindi3
pbListTypeHindi4 | 52 | Hindi4
pbListTypeIroha | 13 | Iroha
pbListTypeKorDbNum1 | 41 | KorDbNum1
pbListTypeKorDbNum2 | 42 | KorDbNum2
pbListTypeKorDbNum3 | 43 | KorDbNum3
pbListTypeKorDbNum4 | 44 | KorDbNum4
pbListTypeLowerCaseLetter | 4 | Lowercase Letter
pbListTypeLowerCaseRoman | 2 | Lowercase Roman
pbListTypeLowerCaseRussian | 58 | Lowercase Russian
pbListTypeNone | 255 | None
pbListTypeOrdinal | 5 | Ordinal
pbListTypeOrdinalText | 7 | OrdinalText
pbListTypeThai1 | 53 | Thai1
pbListTypeThai2 | 54 | Thai2
pbListTypeThai3 | 55 | Thai3
pbListTypeTpeDbNum2 | 34 | DbNum2
pbListTypeTpeDbNum3 | 35 | DbNum3
pbListTypeUpperCaseLetter | 3 | Uppercase Letter
pbListTypeUpperCaseRoman | 1 | Uppercase Roman
pbListTypeUpperCaseRussian | 59 | Uppercase Russian
pbListTypeVietnamese1 | 56 | Vietnamese1
pbListTypeZodiac1 | 30 | Zodiac1
pbListTypeZodiac2 | 31 | Zodiac2


PictureFormat.IsLinked Property (Publisher)

 Copy code hover
[image]

PictureFormat.IsLinked Property (Publisher)
Send feedback

Returns a MsoTriState constant indicating whether the specified picture is a linked picture or OLE object. Read-only.

Syntax

expression .IsLinked

expression A variable that represents an PictureFormat object.

Return Value

MsoTriState

Remarks

Returns msoFalse for pasted or embedded pictures and OLE objects.

If a picture or OLE object is linked, several additional properties of the PictureFormat object dealing with the original picture (such as OriginalFileSize) are accessible.

The IsLinked property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The specified picture is not a linked picture.
msoTriStateMixed | Indicates a combination of msoTrue and msoFalse for the specified shape range.
msoTrue | The specified picture is a linked picture.

Example

The following example returns whether the first shape on the first page of the active publication contains an alpha channel. If the picture is linked, and the original picture contains an alpha channel, that is also returned. This example assumes the shape is a picture.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes(1).PictureFormat
 If .HasAlphaChannel = msoTrue Then
 Debug.Print .Filename
 Debug.Print "This picture contains an alpha channel."

 If .IsLinked = msoTrue Then
 If .OriginalHasAlphaChannel = msoTrue Then
 Debug.Print "The linked picture " & _
 "also contains an alpha channel."
 End If
 End If
 End If
End With


Row Members (Publisher)

 Copy code hover
[image]

Row Members (Publisher)
Send feedback

Represents a row in a table. The Row object is a member of the Rows collection. The Rows collection includes all the rows in a specified table.

Methods

Name | Description
Delete | Deletes the specified object.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Cells | Returns a CellRange object that represents the cell or cells in row of a table.
Height | Returns or sets a Variant that represents the height (in points) of a specified table row or shape. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


WizardProperties.Application Property (Publisher)

 Copy code hover
[image]

WizardProperties.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a WizardProperties object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Options Object (Publisher)

 Copy code hover
[image]

Options Object (Publisher)
Send feedback

Represents application and publication options in Microsoft Publisher. Many of the properties for the Options object correspond to items in the Options dialog box (Tools menu).

Example

Use the Options property to return the Options object. The following example sets four application options for Publisher.

Copy code Copy code
Sub SetSpecialOptions()
 With Options
 .AllowBackgroundSave = True
 .DragAndDropText = True
 .AutoHyphenate = True
 .MeasurementUnit = pbUnitInch
 End With
End Sub


CatalogMergeShapes.Application Property (Publisher)

 Copy code hover
[image]

CatalogMergeShapes.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a CatalogMergeShapes object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Shape.Height Property (Publisher)

 Copy code hover
[image]

Shape.Height Property (Publisher)
Send feedback

Returns or sets a Variant that represents the height (in points) of a specified table row or shape. Read/write.

Syntax

expression .Height

expression A variable that represents a Shape object.

Remarks

The valid range for the Height property depends on the size of the application workspace and the position of the object within the workspace. For centered objects on non-banner page sizes, the Height property may be 0.0 to 50.0 inches. For centered objects on banner page sizes, the Height property may be 0.0 to 241.0 inches.


TextRange Properties (Publisher)

 Copy code hover
[image]

TextRange Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
BoundHeight | Returns a Single indicating the height, in points, of the bounding box for the specified text range. Read-only.
BoundLeft | Returns a Single indicating the distance, in points, from the left edge of the leftmost page to the left edge of the bounding box for the specified text range. Read-only.
BoundTop | Returns a Single indicating the distance, in points, from the top edge of the topmost page to the top edge of the bounding box for the specified text range. Read-only.
BoundWidth | Returns a Single indicating the width, in points, of the bounding box for the specified text range. Read-only.
ContainingObject | Returns an Object that represents the object that contains the text range. Read-only.
DropCap | Returns a DropCap object that represents a dropped capital letter for the paragraphs in the specified text frame.
Duplicate | Returns a TextRange object that represents a duplicate of the specified text range.
End | Sets or returns a Long that represents the ending character position of a selection or text range. Read/write.
Fields | Returns a Fields object that represents all the fields in the specified text range.
Find | Returns a FindReplace object from the specified TextRange object. The FindReplace object is used to perform a text search and replace in the specified text range.
Font | Sets or returns a Font object that represents character formatting attributes applied to the specified object. Read/write.
Hyperlinks | Returns a Hyperlinks collection representing all the hyperlinks in the specified text range.
InlineShapes | Returns an InlineShapes collection, which represents the inline shapes contained within a text range. Read-only.
LanguageID | Returns or sets a MsoLanguageID constant that represents the language for the specified object. Read/write.
Length | Returns a Long value indicating the length of the specified text range, in characters. Read-only.
LinesCount | Returns the number of lines of text in the text range represented by the parent TextRange object. Read-only.
MajorityFont | Returns a Font object that represents the font name most in use in a text range.
MajorityParagraphFormat | Returns a ParagraphFormat object that represents the paragraph formatting applied to most of the paragraphs in a text range.
ParagraphFormat | Returns a ParagraphFormat object representing the paragraph formatting for the specified text range or text style.
ParagraphsCount | Returns the number of paragraphs of text in the text range represented by the parent TextRange object. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Script | Returns a PbFontScriptType constant that represents the font script for a text range. Read-only.
Start | Returns or sets a Long that represents the starting character position of a text range. Read/write.
Story | Returns a Story object that represents the story properties in a text range.
Text | Returns or sets a String that represents the text in a text range or WordArt shape. Read/write.
WordsCount | Returns the number of words in the text range represented by the parent TextRange object. Read-only.


WizardProperty.ID Property (Publisher)

 Copy code hover
[image]

WizardProperty.ID Property (Publisher)
Send feedback

Returns a Long that represents the type of a shape, range of shapes, or property, type, or value of a wizard. Read-only.

Syntax

expression .ID

expression A variable that represents a WizardProperty object.

Example

This example displays the type for each shape on the first page of the active publication.

Copy code Copy code
Sub ShapeID()
 Dim shp As Shape
 For Each shp In ActiveDocument.Pages(1).Shapes
 MsgBox shp.ID
 Next shp
End Sub


TextRange.Delete Method (Publisher)

 Copy code hover
[image]

TextRange.Delete Method (Publisher)
Send feedback

Deletes the specified object.

Syntax

expression .Delete

expression A variable that represents a TextRange object.

Remarks

A run-time error occurs if the specified object does not exist.


Field.Application Property (Publisher)

 Copy code hover
[image]

Field.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a Field object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


ShapeRange.Select Method (Publisher)

 Copy code hover
[image]

ShapeRange.Select Method (Publisher)
Send feedback

Selects the specified object.

Syntax

expression .Select(Replace)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Replace | Optional | Variant | Specifies whether the selection replaces any previous selection. True to replace the previous selection with the new selection; False to add the new selection to the previous selection. Default is True.

Example

This example selects shapes one and three on page one in the active publication.

VBA Copy code Copy code
ActiveDocument.Pages(1).Shapes.Range(Array(1, 3)).Select

This example adds shapes two and four on page one in the active publication to the previous selection.

VBA Copy code Copy code
ActiveDocument.Pages(1).Shapes.Range(Array(2, 4)) _
 .Select Replace:=False


Shape.IncrementRotation Method (Publisher)

 Copy code hover
[image]

Shape.IncrementRotation Method (Publisher)
Send feedback

Changes the rotation of the specified shape around the z-axis (extends outward from the plane of the publication) by the specified number of degrees.

Syntax

expression .IncrementRotation(Increment)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how far the shape is to be rotated around the z-axis, in degrees. A positive value rotates the shape clockwise; a negative value rotates it counterclockwise. Valid values are between - 360 and 360.

Return Value

Nothing

Remarks

Use the Rotation property to set the absolute rotation of the shape.

To rotate a three-dimensional shape around the x-axis (horizontal) or the y-axis (vertical), use the IncrementRotationX method or the IncrementRotationY method, respectively.

Example

This example duplicates the first shape on the active publication, sets the fill for the duplicate, moves it 70 points to the right and 50 points up, and rotates it 30 degrees clockwise.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes(1).Duplicate
 .Fill.PresetTextured PresetTexture:=msoTextureGranite
 .IncrementLeft Increment:=70
 .IncrementTop Increment:=-50
 .IncrementRotation Increment:=30
End With


Stories.Count Property (Publisher)

 Copy code hover
[image]

Stories.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a Stories object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


ShapeRange.Apply Method (Publisher)

 Copy code hover
[image]

ShapeRange.Apply Method (Publisher)
Send feedback

Applies formatting copied from another shape or shape range using the PickUp method.

Syntax

expression .Apply

expression A variable that represents a ShapeRange object.

Return Value

Nothing

Remarks

If you do not first use the PickUp method to copy the formatting from another shape, an error occurs.

Example

The following example copies the formatting from the first shape of the active publication to the second shape of the active publication.

Copy code Copy code
With ActiveDocument.Pages(1)
 .Shapes(1).PickUp
 .Shapes(2).Apply
End With


ShadowFormat.Parent Property (Publisher)

 Copy code hover
[image]

ShadowFormat.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a ShadowFormat object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


MailMergeMappedDataField Object (Publisher)

 Copy code hover
[image]

MailMergeMappedDataField Object (Publisher)
Send feedback

Represents a single mapped data field. The MailMergeMappedDataField object is a member of the MailMergeMappedDataFields collection. A mapped data field is a field contained within Microsoft Publisher that represents commonly used name or address information, such as First Name. If a data source contains a First Name field or a variation (such as First_Name, FirstName, First, or FName), the field in the data source will automatically map to the corresponding mapped data field. If a publication is to be merged with more than one data source, mapped data fields make it unnecessary to reenter the fields into the publication to agree with the field names in the database.

Example

Use MappedDataFields(index) to return a MailMergeMappedDataField object. This example returns the data source field name for the pbFirstName mapped data field. This example assumes the current publication is a mail merge publication. A blank string value returned for the DataFieldName property indicates that the mapped data field is not mapped to a field in the data source.

Copy code Copy code
Sub MappedFieldName()
 Dim strMappedDataField As String
 With ActiveDocument.MailMerge.DataSource
 strMappedDataField = .MappedDataFields(pbFirstName).DataFieldName
 If strMappedDataField <> "" Then
 MsgBox "The mapped data field 'FirstName' is mapped to " _
 & .MappedDataFields(pbFirstName).DataFieldName & "."
 Else
 MsgBox "The mapped data field 'FirstName' is not " & _
 "mapped to any of the data fields in your " & _
 "data source."
 End If
 End With
End Sub


CalloutFormat.AutomaticLength Method (Publisher)

 Copy code hover
[image]

CalloutFormat.AutomaticLength Method (Publisher)
Send feedback

Specifies that the first segment of the callout line (the segment attached to the text callout box) be scaled automatically when the callout is moved.

Syntax

expression .AutomaticLength

expression A variable that represents a CalloutFormat object.

Remarks

Calling this method sets the AutoLength property of the specified object to msoTrue.

Use the CustomLength method to specify that the first segment of the callout line retain the fixed length returned by the Length property whenever the callout is moved. Applies only to callouts whose lines consist of more than one segment (types msoCalloutThree and msoCalloutFour).

Example

This example switches between an automatically-scaling first segment and one with a fixed length for the callout line for the first shape in the active publication. For the example to work, this shape must be a callout.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes(1).Callout
 If .AutoLength Then
 .CustomLength Length:=50
 Else
 .AutomaticLength
 End If
End With


LineFormat.Style Property (Publisher)

 Copy code hover
[image]

LineFormat.Style Property (Publisher)
Send feedback

Returns or sets an MsoLineStyle constant that represents the style of line to apply to a shape or border. Read/write.

Syntax

expression .Style

expression A variable that represents a LineFormat object.

Return Value

MsoLineStyle

Remarks

The Style property value can be one of the MsoLineStyle constants declared in the Microsoft Office type library and shown in the following table.

msoLineSingle

msoLineStyleMixed

msoLineThickBetweenThin

msoLineThickThin

msoLineThinThick

msoLineThinThin

Example

This example adds a new shape and sets the line properties for the shape.

VBA Copy code Copy code
Sub SetLineStyle()
 With ActiveDocument.Pages(1).Shapes.AddShape(msoShapeRectangle, _
 Left:=72, Top:=140, Width:=200, Height:=100)
 .Rotation = 120
 With .Line
 .Weight = 5
 .DashStyle = msoLineDashDotDot
 .Style = msoLineThickBetweenThin
 End With
 End With
End Sub


AdvancedPrintOptions.PageRotated Property (Publisher)

 Copy code hover
[image]

AdvancedPrintOptions.PageRotated Property (Publisher)
See also Send feedback

Gets or sets whether the printed page is rotated 180 degrees. Read/write.

Version Information

Version Added: Publisher 2007

Syntax

expression .PageRotated

expression A variable that represents an AdvancedPrintOptions object.

Return Value

Boolean

Remarks

The PageRotated property setting corresponds to the value of the Paper sheet rotation box on the Printer Setup Wizard tab of the Advanced Printer Setup dialog box in the Microsoft Publisher user interface.

See also

Concepts

AdvancedPrintOptions Object

Other resources

AdvancedPrintOptions Object Members


WebCommandButton.Application Property (Publisher)

 Copy code hover
[image]

WebCommandButton.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a WebCommandButton object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


ThreeDFormat.ContourColor Property (Publisher)

 Copy code hover
[image]

ThreeDFormat.ContourColor Property (Publisher)
See also Send feedback

Returns or sets a ColorFormat object that represents color of the contour of a shape. Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .ContourColor

expression A variable that represents a ThreeDFormat object.

Return value

COLORFORMAT

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


Cell.BorderTop Property (Publisher)

 Copy code hover
[image]

Cell.BorderTop Property (Publisher)
Send feedback

Returns a CellBorder object that represents the top border for a specified table cell.

Syntax

expression .BorderTop

expression A variable that represents a Cell object.

Return Value

CellBorder

Example

This example creates a checkerboard design using borders and a fill color with an existing table. This assumes the first shape on page two is a table and not another type of shape and that the table has an uneven number of columns.

VBA Copy code Copy code
Sub FillCellsByRow()
 Dim shpTable As Shape
 Dim rowTable As Row
 Dim celTable As Cell
 Dim intCell As Integer

 intCell = 1

 Set shpTable = ActiveDocument.Pages(2).Shapes(1)
 For Each rowTable In shpTable.Table.Rows
 For Each celTable In rowTable.Cells
 With celTable
 With .BorderBottom
 .Weight = 2
 .Color.RGB = RGB(Red:=0, Green:=0, Blue:=0)
 End With
 With .BorderTop
 .Weight = 2
 .Color.RGB = RGB(Red:=0, Green:=0, Blue:=0)
 End With
 With .BorderLeft
 .Weight = 2
 .Color.RGB = RGB(Red:=0, Green:=0, Blue:=0)
 End With
 With .BorderRight
 .Weight = 2
 .Color.RGB = RGB(Red:=0, Green:=0, Blue:=0)
 End With
 End With
 If intCell Mod 2 = 0 Then
 celTable.Fill.ForeColor.RGB = RGB _
 (Red:=180, Green:=180, Blue:=180)
 Else
 celTable.Fill.ForeColor.RGB = RGB _
 (Red:=255, Green:=255, Blue:=255)
 End If
 intCell = intCell + 1
 Next celTable
 Next rowTable

End Sub


Shape.AddToCatalogMergeArea Method (Publisher)

 Copy code hover
[image]

Shape.AddToCatalogMergeArea Method (Publisher)
Send feedback

Adds the specified shape or shapes to the publication page's catalog merge area.

Syntax

expression .AddToCatalogMergeArea

expression A variable that represents a Shape object.

Return Value

Nothing

Remarks

The catalog merge area is automatically resized to accommodate objects that are larger than the merge area, or that are positioned outside the catalog merge area when they are added.

The AddToCatalogMergeArea method does not apply to merge data fields:

  • Use the Insert method of the MailMergeDataFields collection to add a picture data field to a publication page's catalog merge area.

  • Use the InsertMailMergeField method of the TextRange object to add a text data field to a text box.

Note that to add a text box that will contain text data fields to a catalog merge area, you use the AddToCatalogMergeArea method.

Example

The following example adds a rectangle to the catalog merge area on the first page of the specified publication. This example assumes a catalog merge area has been added to the first page.

Copy code Copy code
ThisDocument.Pages(1).Shapes.AddShape(1, 80, 75, 450, 125).AddToCatalogMergeArea


Document.WebNavigationBarSets Property (Publisher)

 Copy code hover
[image]

Document.WebNavigationBarSets Property (Publisher)
Send feedback

Returns a WebNavigationBarSets object representing a collection of all WebNavigationBarSet objects in the specified document. Read-only.

Syntax

expression .WebNavigationBarSets

expression A variable that represents a Document object.

Return Value

WebNavigationBarSets

Example

The following example sets an object variable to the collection of Web navigation bar sets in the active document and adds a new navigation bar set to it.

VBA Copy code Copy code
Dim objWebNavBarSets As WebNavigationBarSets

Set objWebNavBarSets = ActiveDocument.WebNavigationBarSets
objWebNavBarSets.AddSet _
 Name:="WebNavBarSet1", _
 Design:=pbnbDesignBracket, _
 AutoUpdate:=True


ParagraphFormat.LockToBaseLine Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.LockToBaseLine Property (Publisher)
Send feedback

Returns an MsoTristate that represents whether or not text will be positioned along baseline guides. Read/write.

Syntax

expression .LockToBaseLine

expression A variable that represents a ParagraphFormat object.

Return Value

MsoTristate

Remarks

The LockToBaseLine property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The text is not aligned to baselines.
msoTriStateMixed | The specified paragraphs contain both text that is aligned to baselines and text that is not aligned to baselines.
msoTrue | The text is aligned to baselines.

Example

The following example sets the LockToBaseLine property to True.

VBA Copy code Copy code
Dim objParaForm As ParagraphFormat
Set objParaForm = ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.ParagraphFormat
objParaForm.LockToBaseLine = msoTrue


ColorScheme Properties (Publisher)

 Copy code hover
[image]

ColorScheme Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Colors | Returns a ColorFormat object representing a color from the specified color scheme.
Name | Returns a String value indicating the name of the specified object. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


MailMerge.OpenDataSource Method (Publisher)

 Copy code hover
[image]

MailMerge.OpenDataSource Method (Publisher)
Send feedback

Attaches a data source to the specified publication, which becomes a main publication if it is not one already.

Syntax

expression .OpenDataSource(bstrDataSource, bstrConnect, bstrTable, fOpenExclusive, fNeverPrompt)

expression A variable that represents a MailMerge object.

Parameters

Name | Required/Optional | Data Type | Description
bstrDataSource | Optional | String | The data source path and file name. You can specify a Microsoft Query (.qry) file instead of specifying a data source, a connection string, and a table name string; values in a Microsoft Query file override values for bstrConnect and bstrTable.
bstrConnect | Optional | String | A connection string.
bstrTable | Optional | String | The name of the table in the data source.
fOpenExclusive | Optional | Long | True to deny others access to the database. False allows others read/write permission to the database. The default value is False.
fNeverPrompt | Optional | Long | Long. True never prompts when opening the data source. False displays the Data Link Properties dialog box. The default value is False.

Remarks

Note Note

If you are using a data source for mail merge, you must add a catalog merge area to the publication page before you attach to the data source.

Example

This example attaches a table from a database and denies everyone else write access to the database while it is opened.

For this example to run properly, you must replace PathToFile with a valid file path and TableName with a valid data source table name.

VBA Copy code Copy code
Sub AttachDataSource()

    ActiveDocument.MailMerge.OpenDataSource _
        bstrDataSource:="PathToFile",  _
        bstrTable:="TableName", _
        fNeverPrompt:=True, fOpenExclusive:=True

End Sub


RulerGuide Properties (Publisher)

 Copy code hover
[image]

RulerGuide Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Position | Returns or sets a Variant representing the font position relative to the baseline of the text in the specified range. Positive values move the text above the normal baseline, negative values move the text below the baseline. Indeterminate values are returned as -9999.0. Read/write.
Type | Returns or sets a PbRulerGuideType constant that represents the ruler guide type. Read/write.


Font.ContextualAlternates Property (Publisher)

 Copy code hover
[image]

Font.ContextualAlternates Property (Publisher)
Send feedback

Returns or sets an MsoTriState constant that represents the state of the ContextualAlternates property on the characters in a text range. The ContextualAlternates property enables different shape choices for some characters depending on the context of the character and the design of the selected font. Read/write.

Version Information

Version Added: Publisher 2010

Syntax

expression .ContextualAlternates

expression A variable that represents a Font object.

Return Value

MsoTriState

Remarks

Note Note

The ContextualAlternates property has an effect only for OpenType fonts that contain contextual alternates.

The ContextualAlternates property value can be one of the following MsoTriState constants declared in the Microsoft Office type library.

Constant | Description
msoFalse | None of the characters in the range are formatted with contextual alternatives.
msoTriStateMixed | Return value indicating that the range contains some text formatted with contextual alternatives and some text not formatted with contextual alternatives.
msoTriStateToggle | Set value that switches between msoTrue and msoFalse.
msoTrue | All characters in the range are formatted with contextual alternatives.


Plate Members (Publisher)

 Copy code hover
[image]

Plate Members (Publisher)
Send feedback

Represents a single printer's plate. The Plate object is a member of the Plates collection.

Methods

Name | Description
ConvertToProcess | Converts the specified plate from spot color to process.
Delete | Deletes the specified plate.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Color | Returns a ColorFormat object representing the color information for the specified object.
Index | Returns a Long that represents the position of a particular item in a specified collection. .
InkName | Returns a PbInkName constant that represents the name of the ink to be printed using this plate. Read-only.
InUse | Returns True if the specified ink (represented by the plate) is used in the publication. Read-only Boolean.
Luminance | Returns or sets a Long indicating a calculated luminance value for the specified plate; used for spot-color trapping. Valid values are from 0 to 100. Read/write.
Name | Returns a String value indicating the name of the specified object. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


GroupShapes Methods (Publisher)

 Copy code hover
[image]

GroupShapes Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Item | Returns an individual object in a specified collection.


ParagraphFormat.FirstLineIndent Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.FirstLineIndent Property (Publisher)
Send feedback

Returns or sets a Variant that represents the amount of space (measured in points) to indent the first line in a paragraph. Read/write.

Syntax

expression .FirstLineIndent

expression A variable that represents a ParagraphFormat object.

Return Value

Variant

Example

This example creates a text box, fills it with text, and indents the first line of every paragraph a half inch.

Copy code Copy code
Sub IndentFirstLines()
 Dim intCount As Integer
 With ActiveDocument.Pages(1).Shapes _
 .AddTextbox(Orientation:=pbTextOrientationHorizontal, _
 Left:=100, Top:=100, Width:=100, Height:=100) _
 .TextFrame.TextRange
 For intCount = 1 To 10
 .InsertAfter NewText:="This is a test. "
 Next intCount
 .ParagraphFormat.FirstLineIndent = InchesToPoints(0.5)
 End With
End Sub


ShapeRange.Count Property (Publisher)

 Copy code hover
[image]

ShapeRange.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a ShapeRange object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


View.ZoomOut Method (Publisher)

 Copy code hover
[image]

View.ZoomOut Method (Publisher)
Send feedback

Decreases the magnification of the specified view.

Syntax

expression .ZoomOut

expression A variable that represents a View object.

Example

This example decreases the magnification of the active view.

Copy code Copy code
Sub Zoom()
 ActiveView.ZoomOut
End Sub


Shape.ZOrder Method (Publisher)

 Copy code hover
[image]

Shape.ZOrder Method (Publisher)
Send feedback

Moves the specified shape in front of or behind other shapes in the collection (that is, changes the shape's position in the z-order).

Syntax

expression .ZOrder(ZOrderCmd)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
ZOrderCmd | Required | MsoZOrderCmd | Specifies where to move the specified shape relative to the other shapes.

Return Value

Nothing

Remarks

The ZOrderCmd parameter can be one of the MsoZOrderCmd constants declared in the Microsoft Office type library and shown in the following table.

msoBringForward

msoBringInFrontOfText

msoBringToFront

msoSendBackward

msoSendBehindText

msoSendToBack

Use the ZOrderPosition property to determine a shape's current position in the z-order.

Example

This example adds an oval to the active publication and then places the oval second from the back in the z-order if there is at least one other shape on the page.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes _
 .AddShape(Type:=msoShapeOval, _
 Left:=100, Top:=100, Width:=100, Height:=300)
 While .ZOrderPosition > 2
 .ZOrder ZOrderCmd:=msoSendBackward
 Wend
End With


TextStyle.Application Property (Publisher)

 Copy code hover
[image]

TextStyle.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a TextStyle object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Rows.Parent Property (Publisher)

 Copy code hover
[image]

Rows.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a Rows object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


FreeformBuilder Methods (Publisher)

 Copy code hover
[image]

FreeformBuilder Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
AddNodes | Inserts a new segment at the end of the freeform that is being created, and adds the nodes that define the segment. You can use this method as many times as you want to add nodes to the freeform you are creating. When you finish adding nodes, use the ConvertToShape method to create the freeform you just defined.
ConvertToShape | Creates a shape that has the geometric characteristics of the specified FreeformBuilder object. Returns a Shape object that represents the new shape.


FillFormat Methods (Publisher)

 Copy code hover
[image]

FillFormat Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
OneColorGradient | Sets the specified fill to a one-color gradient.
Patterned | Sets the specified fill to a pattern.
PresetGradient | Sets the specified fill to a preset gradient.
PresetTextured | Sets the specified fill to a preset texture.
Solid | Sets the specified fill to a uniform color. Use this method to convert a gradient, textured, patterned, or background fill back to a solid fill.
TwoColorGradient | Sets the specified fill to a two-color gradient. The two fill colors are specified by the ForeColor and BackColor properties.
UserPicture | Fills the specified shape with one large image.
UserTextured | Fills the specified shape with small tiles of an image.


Document.BorderArts Property (Publisher)

 Copy code hover
[image]

Document.BorderArts Property (Publisher)
Send feedback

Returns a BorderArts collection that represents the BorderArt types available for use in the specified publication. Read-only.

Syntax

expression .BorderArts

expression A variable that represents a Document object.

Return Value

BorderArts

Remarks

BorderArt are picture borders that can be applied to text boxes, picture frames, or rectangles.

The BorderArts collection includes any custom BorderArt types created by the user for the specified publication.

Example

The following example returns the BorderArts collection and lists the names of all the BorderArt types available for use in the active publication.

Copy code Copy code
Sub ListBorderArt()
Dim bdaTemp As BorderArts
Dim bdaLoop As BorderArt

Set bdaTemp = ActiveDocument.BorderArts

For Each bdaLoop In bdaTemp
 Debug.Print "The name of this BorderArt is " & bdaLoop.Name
Next bdaLoop
End Sub


PbZoom Enumeration (Publisher)

 Copy code hover
[image]

PbZoom Enumeration (Publisher)
Send feedback

Indicates the zoom setting of the specified view.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbZoomFitSelection | -3 | Resizes the page view to the size of the current selection.
pbZoomPageWidth | -1 | Resizes the page view to the width of the publication.
pbZoomWholePage | -2 | Resizes the page view to the size of a whole page.


Application.ShowFollowUpCustom Property (Publisher)

 Copy code hover
[image]

Application.ShowFollowUpCustom Property (Publisher)
See also Send feedback

Gets or sets the string, if any, that appears as the fourth item under Prepare to follow-up on this mailing on the third Mail Merge task pane in the Microsoft Publisher user interface. Read/write.

Version Information

Version Added: Publisher 2007

Syntax

expression .ShowFollowUpCustom

expression A variable that represents an Application object.

Return Value

String

See also

Concepts

Application Object

Other resources

Application Object Members


Page.ExportEmailHTML Method (Publisher)

 Copy code hover
[image]

Page.ExportEmailHTML Method (Publisher)
Send feedback

Exports the active page of the publication as an HTML file.

Syntax

expression .ExportEmailHTML(Filename)

expression A variable that represents a Page object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | The name of the file to which to export the HTML.

Remarks

If the name of an existing HTML file is specified, that file is overwritten.

This method can only be used on the active page of the publication.

Example

The following example sets the first page in the document as the active page, and exports that page to a file. (Note that PathToFile must be replaced with a valid file path for this example to work.)

Copy code Copy code
Sub ExportEmail()
 Dim strFilePath As String
 strFilePath = "PathToFile"
 With ActiveDocument.ActiveView
 .ActivePage = ActiveDocument.Pages(1)
 .ActivePage.ExportEmailHTML (strFilePath)
 End With

End Sub


View.Application Property (Publisher)

 Copy code hover
[image]

View.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a View object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Options.Application Property (Publisher)

 Copy code hover
[image]

Options.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents an Options object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


RulerGuide Object (Publisher)

 Copy code hover
[image]

RulerGuide Object (Publisher)
Send feedback

Represents a gridline used to align objects on a page. The RulerGuide object is a member of the RulerGuides collection.

Example

Use the Add method of the RulerGuides collection to create a new ruler gridline. Use the Item property to reference a ruler guide. Use the Position property to change the position of a gridline, and use the Delete method to remove a gridline. This example creates a new ruler guide, moves it, and then deletes it.

Copy code Copy code
Sub AddChangeDeleteGuide()
 Dim rgLine As RulerGuide
 With ActiveDocument.Pages(1).RulerGuides
 .Add Position:=InchesToPoints(1), _
 Type:=pbRulerGuideTypeVertical

 MsgBox "The ruler guide position is at one inch."

 .Item(1).Position = InchesToPoints(3)
 MsgBox "The ruler guide is now at three inches."

 .Item(1).Delete
 MsgBox "The ruler guide has been deleted."
 End With
End Sub


TextEffectFormat.FontItalic Property (Publisher)

 Copy code hover
[image]

TextEffectFormat.FontItalic Property (Publisher)
Send feedback

Sets or returns an MsoTriState constant that represents whether the font for a dropped capital letter or WordArt text effect is italic. Read/write.

Syntax

expression .FontItalic

expression A variable that represents a TextEffectFormat object.

Remarks

The FontItalic property value can be one of the MsoTriState constants declared in the Microsoft Office type library.

Example

This example makes the dropped capital letter in the specified text frame italic. This example assumes that the specified text frame is formatted with a dropped capital letter.

VBA Copy code Copy code
Sub BoldDropCap()
 With ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.DropCap
 .FontBold = msoTrue
 .FontColor.RGB = RGB(Red:=150, Green:=50, Blue:=180)
 .FontItalic = msoTrue
 .FontName = "Script MT Bold"
 End With
End Sub


PageBackground Properties (Publisher)

 Copy code hover
[image]

PageBackground Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Exists | True if the specified PageBackground object exists. Read/write Boolean.
Fill | Returns a FillFormat object representing the fill for the specified shape or table cell.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Tag Members (Publisher)

 Copy code hover
[image]

Tag Members (Publisher)
Send feedback

Represents a tag or a custom property that you can create for a shape, shape range, page, or publication. Each Tag object contains the name of a custom property and a value for that property. Tag objects are members of the Tags collection. Create a tag when you want to be able to selectively work with specific members of a collection, based on an attribute that isn't already represented by a built-in property.

Methods

Name | Description
Delete | Deletes the specified object.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Name | Returns a String value indicating the name of the specified object. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Value | Returns or sets a Variant that represents the value of a tag of a shape, page, or publication. Read/write.


ParagraphFormat.SetListType Method (Publisher)

 Copy code hover
[image]

ParagraphFormat.SetListType Method (Publisher)
Send feedback

Sets the list type of the specified ParagraphFormat object. .

Syntax

expression .SetListType(Value, BulletText)

expression A variable that represents a ParagraphFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Value | Required | PbListType | Represents the list type of the specified ParagraphFormat object.
BulletText | Optional | String | String that represents the text of the list bullet.

Remarks

If Value is a bulleted list and the BulletText parameter is missing, the first bullet from the Bullets and Numbering dialog box is used.

BulletText is limited to one character.

A run-time error occurs if the BulletText parameter is provided and the Value parameter is not set to pbListTypeBullet.

The Value parameter can be one of the PbListType constants declared in the Microsoft Publisher type library and shown in the following table.

pbListTypeAiueo

pbListTypeArabic

pbListTypeArabic1

pbListTypeArabic2

pbListTypeArabicLeadingZero

pbListTypeBullet

pbListTypeCardinalText

pbListTypeChiManSty

pbListTypeChinaDbNum1

pbListTypeChinaDbNum2

pbListTypeChinaDbNum3

pbListTypeChinaDbNum4

pbListTypeChosung

pbListTypeCirclenum

pbListTypeDAiueo

pbListTypeDArabic

pbListTypeDbChar

pbListTypeDbNum1

pbListTypeDbNum2

pbListTypeDbNum3

pbListTypeDbNum4

pbListTypeDIroha

pbListTypeGanada

pbListTypeGB1

pbListTypeGB2

pbListTypeGB3

pbListTypeGB4

pbListTypeHebrew1

pbListTypeHebrew2

pbListTypeHex

pbListTypeHindi1

pbListTypeHindi2

pbListTypeHindi3

pbListTypeHindi4

pbListTypeIroha

pbListTypeKoreaDbNum1

pbListTypeKoreaDbNum2

pbListTypeKoreaDbNum3

pbListTypeKoreaDbNum4

pbListTypeLowerCaseLetter

pbListTypeLowerCaseRoman

pbListTypeLowerCaseRussian

pbListTypeNone

pbListTypeOrdinal

pbListTypeOrdinalText

pbListTypeSbChar

pbListTypeTaiwanDbNum1

pbListTypeTaiwanDbNum2

pbListTypeTaiwanDbNum3

pbListTypeTaiwanDbNum4

pbListTypeThai1

pbListTypeThai2

pbListTypeThai3

pbListTypeUpperCaseLetter

pbListTypeUpperCaseRoman

pbListTypeUpperCaseRussian

pbListTypeVietnamese1

pbListTypeZodiac1

pbListTypeZodiac2

pbListTypeZodiac3

Example

This example tests to see if the list type is a numbered list, specifically pbListTypeArabic. If the ListType property is set to pbListTypeArabic, the ListSeparator is set to pbListSeparatorParenthesis. Otherwise the SetListType method is called and passed pbListTypeArabic as the Value parameter and then the ListNumberSeparator property can be set.

VBA Copy code Copy code
Dim objParaForm As ParagraphFormat

Set objParaForm = ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange.ParagraphFormat

With objParaForm
 If .ListType = pbListTypeArabic Then
 .ListNumberSeparator = pbListSeparatorParenthesis
 Else
 .SetListType pbListTypeArabic
 .ListNumberSeparator = pbListSeparatorParenthesis
 End If
End With

This example demonstrates how an organized document structure containing named text frames with lists can be configured. This example assumes that the publication has a naming convention for TextFrame objects containing lists that use the word "list" as a prefix. This example uses nested collection iterations to access each of the TextFrame objects in each Shapes collection of each Page. The ParagraphFormat object of each TextFrame name with the prefix "list" has the ListType and ListBulletFontSize set.

VBA Copy code Copy code
Dim objPage As page
Dim objShp As Shape
Dim objTxtFrm As TextFrame

'Iterate through all pages of th ePublication
For Each objPage In ActiveDocument.Pages
 'Iterate through the Shapes collection of objPage
 For Each objShp In objPage.Shapes
 'Find each TextFrame object
 If objShp.Type = pbTextFrame Then
 'If the name of the TextFrame begins with "list"
 If InStr(1, objShp.Name, "list") <> 0 Then
 Set objTxtFrm = objShp.TextFrame
 With objTxtFrm
 With .TextRange
 With .ParagraphFormat
 .SetListType pbListTypeBullet, "*"
 .ListBulletFontSize = 24
 End With
 End With
 End With
 End If
 End If
 Next
Next


Printer.PrinterName Property (Publisher)

 Copy code hover
[image]

Printer.PrinterName Property (Publisher)
Send feedback

Gets the name of the printer represented by the parent Printer object. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .PrinterName

expression A variable that represents a Printer object.

Return Value

String

Remarks

You can also use the InstalledPrinters property to get a list of the names of the printers installed on the computer.


Fields Members (Publisher)

 Copy code hover
[image]

Fields Members (Publisher)
Send feedback

A collection of Field objects that represent all the fields in a text range.

Methods

Name | Description
AddHorizontalInVertical | Inserts horizontal text into a stream of vertical text and returns the new horizontal text as a Field object.
AddPhoneticGuide | Returns a Field object that represents phonetic text added to the specified range.
Item | Returns an individual object in a specified collection.
Unlink | Replaces the specified field or Fields collection with with their most recent results.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


FillFormat Properties (Publisher)

 Copy code hover
[image]

FillFormat Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
BackColor | Returns or sets a ColorFormat object representing the background color for the specified fill or patterned line. .
ForeColor | Returns or sets a ColorFormat object representing the foreground color for the fill, line, or shadow. Read/write.
GradientAngle | Returns or sets the angle of the gradient fill for the specified fill format. Read/write.
GradientColorType | Returns an MsoGradientColorType constant indicating the gradient color type for the specified fill. Read-only.
GradientDegree | Returns a Single indicating how dark or light a one-color gradient fill is. A value of 0 (zero) means that black is mixed in with the shape's foreground color to form the gradient; a value of 1 means that white is mixed in; and values between 0 and 1 mean that a darker or lighter shade of the foreground color is mixed in. Read-only.
GradientStyle | Returns an MsoGradientStyle constant indicating the gradient style for the specified fill. Read-only.
GradientVariant | Returns a Long indicating the gradient variant for the specified fill. Generally, values are integers from 1 to 4 for most gradient fills. If the gradient style is msoGradientFromTitle or msoGradientFromCenter, this property returns either 1 or 2. The values for this property correspond to the gradient variants (numbered from left to right and from top to bottom) on the Gradient tab in the Fill Effects dialog box. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Pattern | Returns an MsoPatternType constant that represents the pattern applied to the specified fill or line.
PresetGradientType | Returns an MsoPresetGradientType constant that represents the preset gradient type for the specified fill. Read-only.
PresetTexture | Returns an MsoPresetTexture constant that represents the preset texture for the specified fill. Read-only.
RotateWithObject | Returns or sets whether the fill rotates with the specified shape. Read/write.
TextureAlignment | Returns or sets the alignment (the origin of the coordinate grid) for the tiling of the texture fill. Read/write.
TextureHorizontalScale | Returns or sets a Single that specifies the horizontal scaling factor for the texture fill. Read/write.
TextureName | Returns a String indicating the name of the custom texture file for the specified fill. Read-only.
TextureOffsetX | Returns or sets a Long that specifies the horizontal offset of the texture from the origin in points. Read/write.
TextureOffsetY | Returns or sets a Long that specifies the vertical offset of the texture from the origin in points. Read/write.
TextureType | Returns an MsoTextureType constant indicating the texture type for the specified fill. Read-only.
TextureVerticalScale | Returns or sets a Single that specifies the vertical scaling factor for the texture fill. Read/write.
Transparency | Returns or sets the degree of transparency of the specified fill for a shape as a value between 0.0 (opaque) and 1.0 (clear). Read/write.
Type | Returns an MsoFillType constant that represents the fill format type of a shape. Read-only.
Visible | Returns or sets an MsoTriState constant indicating whether the specified object or the formatting applied to the specified object is visible. Read/write.


PbPageNumberType Enumeration (Publisher)

 Copy code hover
[image]

PbPageNumberType Enumeration (Publisher)
Send feedback

Specifies whether the page number is the current page number or the next or previous page number of a linked text box.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbPageNumberCurrent | 1 | Default.
pbPageNumberNextInStory | 2 | Inserts the page number of the next linked text box.
pbPageNumberPreviousInStory | 3 | Inserts the page number of the previous linked text box.


LayoutGuides Object (Publisher)

 Copy code hover
[image]

LayoutGuides Object (Publisher)
Send feedback

Represents the measurement grid that appears superimposed on publication pages as an aid to laying out design elements.

Example

Use the LayoutGuides property of the Document object to return a LayoutGuides object. Use the LayoutGuide object's margin properties and Rows and Columns properties to set how many rows and columns are displayed in the layout guides and where they appear on a page.

This example sets the margins of the active presentation to two inches.

Copy code Copy code
With ActiveDocument.LayoutGuides
 .MarginTop = Application.InchesToPoints(Value:=2)
 .MarginBottom = Application.InchesToPoints(Value:=2)
 .MarginLeft = Application.InchesToPoints(Value:=2)
 .MarginRight = Application.InchesToPoints(Value:=2)
End With


Window Members (Publisher)

 Copy code hover
[image]

Window Members (Publisher)
Send feedback

Represents a window. Many publication characteristics, such as scroll bars and rulers, are actually properties of the window.

Methods

Name | Description
Activate | Activates a window or OLE object.
Move | Moves the active document window.
Resize | Sizes the Microsoft Publisher application window.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Caption | Returns or sets a String indicating the caption at the top of the Microsoft Publisher application window. Read/write.
Height | Returns or sets a Long that represents the height (in points) of the window. Read/write.
Hwnd | Returns a Long indicating the handle to the Microsoft Publisher application window. Read-only.
Left | Returns or sets a Long indicating the position (in points) of the left edge of the application window relative to the left edge of the screen. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Top | Returns or sets a Long that represents the distance between the top edge of the screen and the application window. Read/write.
Visible | True if the window is visible. Read/write Boolean.
Width | Returns or sets a Long that represents the width (in points) of the window. Read/write.
WindowState | Returns or sets a PbWindowState constant indicating the state of the Microsoft Publisher window. Read/write.


Attachment.Name Property (Publisher)

 Copy code hover
[image]

Attachment.Name Property (Publisher)
See also Send feedback

Returns the name of the attachment. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .Name

expression A variable that represents an Attachment object.

Return Value

String

See also

Concepts

Attachment Object

Other resources

Attachment Object Members


Plates.Item Property (Publisher)

 Copy code hover
[image]

Plates.Item Property (Publisher)
Send feedback

Returns an individual object from a specified collection. Read-only.

Syntax

expression .Item(Index)

expression A variable that represents a Plates object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The number of the object to return.

Example

This example displays the name of the first color plate in the active publication.

VBA Copy code Copy code
MsgBox "Name of first color plate: " _
 & ActiveDocument.Plates.Item(1).Name


WebCommandButton.DataFileFormat Property (Publisher)

 Copy code hover
[image]

WebCommandButton.DataFileFormat Property (Publisher)
Send feedback

Sets or returns a PbSubmitDataFormatType constant that represents the format to use when saving Web form data to a file. Read/write.

Syntax

expression .DataFileFormat

expression A variable that represents a WebCommandButton object.

Return Value

PbSubmitDataFormatType

Remarks

The DataFileFormat property value can be one of the PbSubmitDataFormatType constants declared in the Microsoft Publisher type library.

Example

This example sets Microsoft Publisher to process Web form data by saving it to a comma-delimited text file on the same Web server as the form is stored. (Note that Filename must be replaced with a valid file name for this example to work.)

VBA Copy code Copy code
Sub WebDataFile()
 With ThisDocument.Pages(1).Shapes(1).WebCommandButton
 .DataRetrievalMethod = pbSubmitDataRetrievalSaveOnServer
 .DataFileFormat = pbSubmitDataFormatCSV
 .DataFileName = "Filename"
 End With
End Sub


ReaderSpread.Left Property (Publisher)

 Copy code hover
[image]

ReaderSpread.Left Property (Publisher)
Send feedback

Returns a Single indicating the position (in points) of the left edge of the reader spread from the workspace. Read-only.

Syntax

expression .Left

expression A variable that represents a ReaderSpread object.


Plates Members (Publisher)

 Copy code hover
[image]

Plates Members (Publisher)
Send feedback

A collection of Plate objects in a publication.

Methods

Name | Description
Add | Adds a new color plate to the specified Plates object.
FindPlateByInkName | Returns a Plate object that represents the plate of the specified ink name.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Item | Returns an individual object from a specified collection. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


CalloutFormat.Drop Property (Publisher)

 Copy code hover
[image]

CalloutFormat.Drop Property (Publisher)
Send feedback

For callouts with an explicitly set drop value, this property returns the vertical distance from the edge of the text bounding box to the place where the callout line attaches to the text box. This distance is measured from the top of the text box unless the AutoAttach property is set to True and the text box is to the left of the origin of the callout line (where the callout points). In this case, the drop distance is measured from the bottom of the text box. Read-only Variant.

Syntax

expression .Drop

expression A variable that represents a CalloutFormat object.

Return Value

Variant

Remarks

Numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

Use the CustomDrop method to set the value of this property.

The value of this property accurately reflects the position of the callout line attachment to the text box only if the callout has an explicitly set drop value — that is, if the value of the DropType property is msoCalloutDropCustom.

Example

This example replaces the custom drop for the first shape in the active publication with one of two preset drops, depending on whether the custom drop value is greater than or less than half the height of the callout text box. For the example to work, the shape must be a callout.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes(1).Callout
 If .DropType = msoCalloutDropCustom Then
 If .Drop < .Parent.Height / 2 Then
 .PresetDrop DropType:=msoCalloutDropTop
 Else
 .PresetDrop DropType:=msoCalloutDropBottom
 End If
 End If
End With


WebHiddenFields.Delete Method (Publisher)

 Copy code hover
[image]

WebHiddenFields.Delete Method (Publisher)
Send feedback

Deletes the specified hidden Web field or Web list box item object.

Syntax

expression .Delete(Index)

expression A variable that represents a WebHiddenFields object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The number of the Web field or list box item to delete.


PbVerticalTextAlignmentType Enumeration (Publisher)

 Copy code hover
[image]

PbVerticalTextAlignmentType Enumeration (Publisher)
Send feedback

Represents the vertical alignment of text in a text box.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbVerticalTextAlignmentBottom | 2 | Text is aligned to the bottom.
pbVerticalTextAlignmentCenter | 1 | Text is aligned to the center.
pbVerticalTextAlignmentTop | 0 | Text is aligned to the top.


FillFormat.TextureOffsetX Property (Publisher)

 Copy code hover
[image]

FillFormat.TextureOffsetX Property (Publisher)
See also Send feedback

Returns or sets a Long that specifies the horizontal offset of the texture from the origin in points. Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .TextureOffsetX

expression A variable that represents a FillFormat object.

Property value

FLOAT

Remarks

The position of the origin is determined by the setting of the TextureAlignment property.

The setting of the TextureOffsetX property corresponds to the setting of the Offset X box on the Fill pane of the Format Shape dialog box in the Publisher 2013 user interface (under Drawing Tools, on the Format tab, click Shape Fill, point to Texture, and then click More Textures.)

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


ShapeNode Object (Publisher)

 Copy code hover
[image]

ShapeNode Object (Publisher)
Send feedback

Represents the geometry and the geometry-editing properties of the nodes in a user-defined freeform. Nodes include the vertices between the segments of the freeform and the control points for curved segments. The ShapeNode object is a member of the ShapeNodes collection. The ShapeNodes collection contains all the nodes in a freeform.

Example

Use Nodes(index), where index is the node index number, to return a single ShapeNode object. If node one in shape three on the active document is a corner point, the following example makes it a smooth point. For this example to work, shape one must be a freeform.

Copy code Copy code
Sub ChangeNodeType()
 With ActiveDocument.Pages(1).Shapes(1)
 If .Nodes(1).EditingType = msoEditingCorner Then
 .Nodes.SetEditingType Index:=1, EditingType:=msoEditingSmooth
 End If
 End With
End Sub


Font Members (Publisher)

 Copy code hover
[image]

Font Members (Publisher)
Send feedback

Contains font attributes (font name, font size, color, and so on) for an object.

Methods

Name | Description
Duplicate | Creates a duplicate of the specified Font object and then returns the new Font object.
GetScriptName | Returns a String that represents the name of the font script being used in a text range.
Grow | Increases the font size to the next available size.
Reset | Removes manual paragraph or text formatting from the specified object and leaves only the formatting specified by the current text style.
SetScriptName | Sets the name of the font script to use in a text range.
Shrink | Decreases the font size to the next available size. If the selection or range contains more than one font size, each size is decreased to the next available setting.

Properties

Name | Description
AllCaps | Returns or sets msoTrue if the font is formatted as all capital letters, or returns one of the other MsoTriState constants if it is not. Read/write.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
AttachedToText | True if the Font or ParagraphFormat object is attached to a TextRange object. If the object is attached to a TextRange object, the document will be updated when properties of the object are changed. If the object is not attached, nothing in the document will be changed until the object is applied to a TextRange or Style object. Read-only Boolean.
AutomaticPairKerningThreshold | Returns or sets a Variant value that represents the point size above which kerning is automatically adjusted for characters in the specified text range. Read/write.
Bold | Returns or sets an MsoTriState constant that represents the state of the Bold property on the characters in a text range. Read/write.
BoldBi | Returns or sets an MsoTriState constant indicating whether the font is bold; used with text in a right-to-left language. Read/write.
ContextualAlternates | Returns or sets an MsoTriState constant that represents the state of the ContextualAlternates property on the characters in a text range. The ContextualAlternates property enables different shape choices for some characters depending on the context of the character and the design of the selected font. Read/write.
DiacriticColor | Returns a ColorFormat object representing the 24-bit color used for diacritics in a right-to-left language publication.
ExpandUsingKashida | Returns or sets an MsoTriState constant indicating whether to apply kashida rules while applying tracking to Arabic text. Read/write.
Fill | Returns a FillFormat object that contains fill formatting properties for the font used by the specified range of text. Read-only.
Glow | Returns a GlowFormat object that represents the glow formatting for the font used by the specified range of text. Read-only.
Italic | Returns or sets an MsoTriState constant indicating whether the specified text is formatted as italic. Read/write.
ItalicBi | Returns or sets an MsoTriState constant indicating whether the specified text is formatted as italic; applies to text in a right-to-left language. Read/write.
Kerning | Returns or sets a Variant indicating the amount of horizontal spacing Microsoft Publisher applies to the characters in the text range. Read/write.
Ligature | Returns or sets a pbLigaturePresetType constant that represents the state of the Ligature property on the characters in a text range. The Ligature property enables embellishments to the characters, often in the form of bigger and more flamboyant serifs. Read/write.
Line | Returns a LineFormat object that specifies the formatting for a line. Read/write.
Name | Indicates the name of the specified font. Read/write.
NumberStyle | Returns or sets a pbNumberStyles constant that represents the state of the NumberStyles property on the numerical characters in a text range. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Position | Returns or sets a Variant representing the font position relative to the baseline of the text in the specified range. Positive values move the text above the normal baseline, negative values move the text below the baseline. Indeterminate values are returned as -9999.0. Read/write.
Reflection | Returns a ReflectionFormat object that represents the reflection formatting for a shape. Read-only.
Scaling | Returns or sets a Variant value used to scale the width of the characters in the text range as a percentage of the current font size. Read/write.
Size | Represents the size of the characters in the text range in points. Read/write.
SizeBi | Returns or sets a Variant value representing the size, in points, of the Font object for text in a right-to-left language. Valid range is 0.5 points to 999.5 points. Read/write.
SmallCaps | Returns or sets an MsoTriState constant indicating whether the specified text is formatted as small caps. Read/write.
StrikeThrough | Returns or sets an MsoTriState constant that represents the state of the StrikeThrough property on the characters in a text range. Read/write.
StylisticAlternates | Returns or sets a Variant that represents the state of the StylisticAlternates property on the characters in a text range. The StylisticAlternates property allows you to select an alternate look for the look of the characters you have selected, if the font designer has created these alternates. Read/write.
StylisticSets | Returns or sets a Variant that represents the state of the StylisticSets property on the characters in a text range. Read/write.
SubScript | Returns or sets an MsoTriState constant indicating whether characters are formatted as subscript in the specified text range. Read/write.
SuperScript | Returns or sets an MsoTriState constant indicating whether characters are formatted as superscript in the specified text range. Read/write.
Swash | Returns or sets an MsoTriState constant that represents the state of the Swash property on the characters in a text range. The Swash property enables embellishments to the characters, often in the form of bigger and more flamboyant serifs. Read/write.
TextShadow | Returns a ShadowFormat object that specifies the shadow formatting for the specified font.
ThreeD | Returns a ThreeDFormat object that contains 3-D effect formatting properties for the specified font. Read-only.
Tracking | Returns or sets a Variant indicating the tracking value used to display space between the characters in the specified text range. Read/write.
TrackingPreset | Returns or sets a PbTrackingPresetType constant representing the preset tracking type for characters in the specified font in a text range. Read/write.
Underline | Returns or sets an PbUnderlineType constant that indicates the type of underline for the selected characters in the specified font in a text range. Read/write.
UseDiacriticColor | Returns or sets MsoTriState constant indicating whether you can set the color of diacritics in the specified text range. Read/write.


Selection.Unselect Method (Publisher)

 Copy code hover
[image]

Selection.Unselect Method (Publisher)
Send feedback

Cancels the current selection.

Syntax

expression .Unselect

expression A variable that represents a Selection object.

Example

This example cancels the current selection in the active publication.

Copy code Copy code
ActiveDocument.Selection.Unselect


PictureFormat.RecoloredPictureColor Property (Publisher)

 Copy code hover
[image]

PictureFormat.RecoloredPictureColor Property (Publisher)
Send feedback

Returns the color that has been applied to the image represented by the parent PictureFormat object. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .RecoloredPictureColor

expression A variable that represents a PictureFormat object.

Return Value

ColorFormat


ParagraphFormat.TextStyle Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.TextStyle Property (Publisher)
Send feedback

Returns or sets a Variant that represents the text style applied to a paragraph. Read/write.

Syntax

expression .TextStyle

expression A variable that represents a ParagraphFormat object.

Return Value

Variant

Example

This example changes the text style of the selection if the selection isn't formatted with the Normal text style. This example assumes text is selected in the active publication.

VBA Copy code Copy code
Sub SetTextStyle()
 With Selection.TextRange.ParagraphFormat
 If .TextStyle <> "Normal" Then _
 .TextStyle = "Normal"
 End With
End Sub


Document.SetBusinessInformation Method (Publisher)

 Copy code hover
[image]

Document.SetBusinessInformation Method (Publisher)
Send feedback

Applies the specified business information set, which consists of a logo image and business contact information (such as the company name and address), to the current publication.

Version Information

Version Added: Publisher 2007

Syntax

expression .SetBusinessInformation(Name)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | Name of the business information set to be applied.

Remarks

Calling the SetBusinessInformation method corresponds to selecting a business information set (in the Select a Business Information set list) and then clicking the Update Publication button in the Business Information dialog box (Edit menu) in the Microsoft Publisher user interface (UI). You must create and edit business information sets in that dialog box before you can use the SetBusinessInformation method to apply them programatically.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the SetBusinessInformation method to apply a specific business information set to the current publication. Before you run this code, substitute for BISetName the name of a business information set that you have previously created in the Publisher UI.

VBA Copy code Copy code
Public Sub SetBusinessInformation_Example()

 ThisDocument.SetBusinessInformation "BISetName"

End Sub


ObjectVerbs Members (Publisher)

 Copy code hover
[image]

ObjectVerbs Members (Publisher)
Send feedback

Represents the collection of OLE verbs for the specified OLE object. OLE verbs are the operations supported by an OLE object. Commonly used OLE verbs are play and edit.

Methods

Name | Description
Item | Returns an individual object in a specified collection.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


ColorScheme.Name Property (Publisher)

 Copy code hover
[image]

ColorScheme.Name Property (Publisher)
Send feedback

Returns a String value indicating the name of the specified object. Read-only.

Syntax

expression .Name

expression A variable that represents a ColorScheme object.

Remarks

You can use an object's name in conjunction with the Item method or Item property to return a reference to the object if the Item method or property for the collection that contains the object takes a Variant argument. For example, if the value of the Name property for a shape is Rectangle 2, then .Shapes("Rectangle 2") will return a reference to that shape.

The Name property is the default property for the BorderArt, BorderArtFormat, and Label objects.

Example

This example reports the name of the color scheme for the active publication.

VBA Copy code Copy code
MsgBox "The current color scheme is " _
 & ActiveDocument.ColorScheme.Name & "."


WebCommandButton.EmailAddress Property (Publisher)

 Copy code hover
[image]

WebCommandButton.EmailAddress Property (Publisher)
Send feedback

Sets or returns a String representing the e-mail address to use when processing Web form data. Read/write.

Syntax

expression .EmailAddress

expression A variable that represents an WebCommandButton object.

Return Value

String

Example

This example sets Microsoft Publisher to process data on the Web form in the current publication by sending an e-mail message to a specified e-mail address.

Copy code Copy code
Sub WebFormData()
 With ThisDocument.Pages(1).Shapes(1).WebCommandButton
 .DataRetrievalMethod = pbSubmitDataRetrievalEmail
 .EmailAddress = "someone@example.com"
 .EmailSubject = "Web form data"
 End With
End Sub


Shape.GroupItems Property (Publisher)

 Copy code hover
[image]

Shape.GroupItems Property (Publisher)
Send feedback

Returns a GroupShapes collection if the specified shape is a group.

Syntax

expression .GroupItems

expression A variable that represents a Shape object.

Remarks

All smart objects will be treated as grouped shapes.

Example

This example adds three triangles to a publication, groups them, sets a color for the entire group, and then changes the color for the second triangle only.

Copy code Copy code
Sub Grouper()

 Dim docSheet As Document

 Set docSheet = ActiveDocument
 With docSheet.MasterPages.Item(1).Shapes
 ' Add the 3 triangles
 .AddShape(Type:=msoShapeIsoscelesTriangle, _
 Left:=10, Top:=10, Width:=100, Height:=100).Name = "shpOne"
 .AddShape(Type:=msoShapeIsoscelesTriangle, _
 Left:=150, Top:=10, Width:=100, Height:=100).Name = "shpTwo"
 .AddShape(Type:=msoShapeIsoscelesTriangle, _
 Left:=300, Top:=10, Width:=100, Height:=100).Name = "shpThree"
 ' Group and fill the 3 triangles
 With .Range(Array("shpOne", "shpTwo", "shpThree")).Group
 .Fill.PresetTextured msoTextureBlueTissuePaper
 .GroupItems(2).Fill.PresetTextured msoTextureGreenMarble
 End With
 End With

End Sub


Field.TextRange Property (Publisher)

 Copy code hover
[image]

Field.TextRange Property (Publisher)
Send feedback

Returns a TextRange object that represents the text that is attached to a shape and properties and methods for manipulating the text.

Syntax

expression .TextRange

expression A variable that represents a Field object.

Example

The following example adds text to the text frame of shape one in the active publication, and then formats the new text. This example assumes there is at least one shape on the first page of the active publication.

Copy code Copy code
Sub AddTextToTextFrame()
 With ActiveDocument.Pages(1).TextFrame.TextRange
 .Text = "My Text"
 With .Font
 .Bold = msoTrue
 .Size = 25
 .Name = "Arial"
 End With
 End With
End Sub

The following example adds a rectangle to the active publication and adds text to it.

Copy code Copy code
Sub AddTextToShape()
 With ActiveDocument.Pages(1).Shapes.AddShape(Type:=msoShapeRectangle, _
 Left:=72, Top:=72, Width:=250, Height:=140)
 .TextFrame.TextRange.Text = "Here is some test text"
 End With
End Sub


Column.Delete Method (Publisher)

 Copy code hover
[image]

Column.Delete Method (Publisher)
Send feedback

Deletes the specified object.

Syntax

expression .Delete

expression A variable that represents a Column object.

Remarks

A run-time error occurs if the specified object does not exist.


MalMergeDataField.FieldType Property (Publisher)

 Copy code hover
[image]

MalMergeDataField.FieldType Property (Publisher)
Send feedback

Returns a pbMailMergeDataFieldType constant that represents the type of data contained in the data field.

Syntax

expression .FieldType

expression A variable that represents a MailMergeDataField object.

Return Value

PbMailMergeDataFieldType

Return value

PBMAILMERGEDATAFIELDTYPE

Remarks

Use the Insert method of the MailMergeDataField object to add a picture data field to a publication's catalog merge area.

Use the InsertMailMergeField method of the TextRange object to add a text data field to a text box in the publication's catalog merge area.

The FieldType property value can be one of the PbMailMergeDataFieldType constants declared in the Microsoft Publisher type library.

Example

This example defines a data field as a picture data field, inserts it into the catalog merge area of the specified publication, and sizes and positions the picture data field. This example assumes that the publication has been connected to a data source, and that a catalog merge area has been added to the publication.

VBA Copy code Copy code
Dim pbPictureField1 As Shape

 'Define the Photo field as a picture data type
 With ThisDocument.MailMerge.DataSource.DataFields
 .Item("Photo:").FieldType = pbMailMergeDataFieldPicture
 End With

 'Insert a picture field, then size and position it
 Set pbPictureField1 = ThisDocument.MailMerge.DataSource.DataFields.Item("Photo:").Insert
 With pbPictureField1
 .Height = 100
 .Width = 100
 .Top = 85
 .Left = 375
 End With


Column.Width Property (Publisher)

 Copy code hover
[image]

Column.Width Property (Publisher)
Send feedback

Returns or sets a Variant that represents the width (in points) of a specified table column or shape. Read/write.

Syntax

expression .Width

expression A variable that represents a Column object.

Example

This example creates a new table and sets the height and width of the second row and column, respectively.

VBA Copy code Copy code
Sub SetRowHeightColumnWidth()
 With ActiveDocument.Pages(1).Shapes.AddTable(NumRows:=3, _
 NumColumns:=3, Left:=80, Top:=80, Width:=400, Height:=12).Table
 .Rows(2).Height = 72
 .Columns(2).Width = 72
 End With
End Sub


TextFrame.MarginTop Property (Publisher)

 Copy code hover
[image]

TextFrame.MarginTop Property (Publisher)
Send feedback

Returns or sets a Variant that represents the amount of space (in points) between the text and the top edge of a cell, text frame, or page. Read/write.

Syntax

expression .MarginTop

expression A variable that represents a TextFrame object.

Example

This example sets the margins of the active publication to two inches.

Copy code Copy code
Sub SetPageMargins()

 With ActiveDocument.LayoutGuides
 .MarginTop = Application.InchesToPoints(Value:=2)
 .MarginBottom = Application.InchesToPoints(Value:=2)
 .MarginLeft = Application.InchesToPoints(Value:=2)
 .MarginRight = Application.InchesToPoints(Value:=2)
 End With

End Sub


FindReplace.Application Property (Publisher)

 Copy code hover
[image]

FindReplace.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a FindReplace object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Adjustments.Application Property (Publisher)

 Copy code hover
[image]

Adjustments.Application Property (Publisher)
See also Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents an Adjustments object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next

See also

Concepts

Adjustments Object

Other resources

Adjustments Object Members


Document.Undo Event (Publisher)

 Copy code hover
[image]

Document.Undo Event (Publisher)
Send feedback

Occurs when a user undoes the last action performed.

Syntax

expression .Undo

expression A variable that represents a Document object.

Remarks

The Undo event occurs immediately after the action is undone.

If multiple actions are undone, the Undo event occurs only once, after all the actions are undone.

For more information about using events with the Document object, see Using Events with the Document Object.

Example

This example displays a message when the user clicks Undo on the Standard toolbar or selects Undo from the Edit menu. For this routine to work with the current publication, you must put it in the ThisDocument module.

Copy code Copy code
Private Sub DocPub_Undo()
 MsgBox "Your last action has been reversed."
End Sub

To trap this event from a non-Microsoft Publisher project, you must place the following code in the General Declarations section of your module and run the InitiatePubApp routine.

Copy code Copy code
Private WithEvents DocPub As Publisher.Document

Sub InitiatePubApp()
 Set DocPub = Publisher.ActiveDocument
End Sub


Application.SnapToGuides Property (Publisher)

 Copy code hover
[image]

Application.SnapToGuides Property (Publisher)
See also Send feedback

True for Microsoft Publisher to use the guides to align objects on a page in a publication. Read/write Boolean.

Syntax

expression .SnapToGuides

expression A variable that represents a Application object.

Return Value

Boolean

Example

This example adds horizontal and vertical ruler guides every half inch on the first page and then sets the options to align objects on the page to the guides.

VBA Copy code Copy code
Sub SetSnapOptions()
 Dim intCount As Integer
 Dim intPos As Integer
 With ActiveDocument.Pages(1).RulerGuides
 For intCount = 1 To 16
 intPos = intPos + 36
 .Add Position:=intPos, Type:=pbRulerGuideTypeVertical
 Next
 intPos = 0
 For intCount = 1 To 21
 intPos = intPos + 36
 .Add Position:=intPos, Type:=pbRulerGuideTypeHorizontal
 Next
 End With
 With Application
 .SnapToGuides = True
 .SnapToObjects = True
 End With
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


TextStyles.Application Property (Publisher)

 Copy code hover
[image]

TextStyles.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a TextStyles object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Font.SubScript Property (Publisher)

 Copy code hover
[image]

Font.SubScript Property (Publisher)
Send feedback

Returns or sets an MsoTriState constant indicating whether characters are formatted as subscript in the specified text range. Read/write.

Syntax

expression .SubScript

expression A variable that represents a Font object.

Return Value

MsoTriState

Remarks

The SubScript property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | No characters in the range are formatted as subscript.
msoTriStateMixed | Return value indicating a combination of msoTrue and msoFalse for the specified shape range.
msoTriStateToggle | Set value that switches between msoTrue and msoFalse.
msoTrue | All characters in the range are formatted as subscript.

Setting the SubScript property to msoTrue removes superscript formatting from the text range.

Example

This example tests the text in the second story and, if it has mixed subscripting, it formats all the text as subscript.

VBA Copy code Copy code
Sub SubScript()

 Dim fntSS As Font

 Set fntSS = Application.ActiveDocument.Stories(2).TextRange.Font
 With fntSS
 If .SubScript = msoTriStateMixed Then
 .SubScript = msoTrue
 Else
 MsgBox "Mixed subscript not in this story."
 End If
 End With

End Sub


Plate.Application Property (Publisher)

 Copy code hover
[image]

Plate.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a Plate object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Document Events (Publisher)

 Copy code hover
[image]

Document Events (Publisher)
Send feedback

This object has the following events:

Events

Name | Description
BeforeClose | Occurs immediately before any open document closes.
Open | Occurs when a publication is opening.
Redo | Occurs when reversing the last action that was undone.
ShapesAdded | Occurs when one or more new shapes are added to a publication. This event occurs whether shapes are added manually or programmatically.
ShapesRemoved | Occurs when a shape is deleted from a publication.
Undo | Occurs when a user undoes the last action performed.
WizardAfterChange | Occurs after the user chooses an option in the wizard pane that changes any of the following settings in the publication: page layout (page size, fold type, orientation, label product), print setup (paper size, print tiling), adding or deleting objects, adding or deleting pages, or object or page formatting (size, position, fill, border, background, default text, text formatting).


Shape.Adjustments Property (Publisher)

 Copy code hover
[image]

Shape.Adjustments Property (Publisher)
Send feedback

Returns an Adjustments collection representing all adjustment handles for the specified Shape or ShapeRange object.

Syntax

expression .Adjustments

expression A variable that represents a Shape object.

Remarks

Adjustment handles correspond to Microsoft Publisher shape sliders.

Example

This example takes the number of adjustments for a given shape range and assigns it to a variable.

Copy code Copy code
Public Sub Counter()

 Dim intCount as Integer

 ' A Shape must be in the active publication and selected.
 intCount = Publisher.ActiveDocument.Selection _
 .ShapeRange(1).Adjustments.Count

End Sub


WebOptions Object (Publisher)

 Copy code hover
[image]

WebOptions Object (Publisher)
Send feedback

Represents the properties of a Web publication, including options for saving and encoding the publication, and enabling Web-safe fonts and font schemes. The WebOptions object is a member of the Application object.

Remarks

The properties of the WebOptions object are used to specify the behavior of Web publications. This means that when any of these properties are modified, newly created Web publications inherit the modified properties.

Note that the WebOptions object is available from print publications and Web publications. However, the properties of this object have no effect on print publications.

Example

Use the WebOptions property on the Application object to return a WebOptions object. The following example sets an object variable equal to the Microsoft Publisher WebOptions object.

Copy code Copy code
Dim theWO As WebOptions

Set theWO = Application.WebOptions


WebNavigationBarHyperlinks Properties (Publisher)

 Copy code hover
[image]

WebNavigationBarHyperlinks Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Object model reference (Publisher 2013 developer reference)

 Copy code hover
[image]

Object model reference (Publisher 2013 developer reference)
Send feedback

This section contains documentation for all of the objects, properties, methods, and events contained in the Publisher object model. You can use the table of contents to navigate through the documentation.


LayoutGuides.HorizontalBaseLineSpacing Property (Publisher)

 Copy code hover
[image]

LayoutGuides.HorizontalBaseLineSpacing Property (Publisher)
Send feedback

Returns a Single that represents the horizontal baseline spacing of the specified LayoutGuides object. Read/write.

Syntax

expression .HorizontalBaseLineSpacing

expression A variable that represents a LayoutGuides object.

Return Value

Single

Remarks

When setting the layout guide properties of a Page object it must be returned from the MasterPages collection.

Example

This example sets the horizontal baseline spacing of the layout guides object to 20 for the second master page in the active document.

Copy code Copy code
Dim objLayout As LayoutGuides
Set objLayout = ActiveDocument.MasterPages(2).LayoutGuides
objLayout.HorizontalBaseLineSpacing = 20


LineFormat.EndArrowheadWidth Property (Publisher)

 Copy code hover
[image]

LineFormat.EndArrowheadWidth Property (Publisher)
Send feedback

Returns or sets an MsoArrowheadWidth constant indicating the width of the arrowhead at the end of the specified line. Read/write.

Syntax

expression .EndArrowheadWidth

expression A variable that represents an LineFormat object.

Return Value

MsoArrowheadWidth

Remarks

Use the BeginArrowheadWidth property to return or set the width of the arrowhead at the beginning of the line.

The EndArrowheadWidth property value can be one of the MsoArrowheadWidth constants declared in the Microsoft Office type library.

Example

This example adds a line to the active publication. There is a short, narrow oval on the line's starting point and a long, wide triangle on its endpoint.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes _
 .AddLine(BeginX:=100, BeginY:=100, _
 EndX:=200, EndY:=300).Line
 .BeginArrowheadLength = msoArrowheadShort
 .BeginArrowheadStyle = msoArrowheadOval
 .BeginArrowheadWidth = msoArrowheadNarrow
 .EndArrowheadLength = msoArrowheadLong
 .EndArrowheadStyle = msoArrowheadTriangle
 .EndArrowheadWidth = msoArrowheadWide
End With


Application.CommandBars Property (Publisher)

 Copy code hover
[image]

Application.CommandBars Property (Publisher)
See also Send feedback

Sets or returns a CommandBars collection that represents the menu bar and all the toolbars in Microsoft Publisher.

Syntax

expression .CommandBars

expression A variable that represents a Application object.

Return Value

CommandBars

Example

This example enlarges all command bar buttons, enables ToolTips, and shows all menu items when displaying menus.

VBA Copy code Copy code
Sub CmdBars()

 With CommandBars
 .LargeButtons = False
 .DisplayTooltips = True
 .AdaptiveMenus = False
 End With

End Sub

This example displays the Objects toolbar at the bottom of the application window.

Copy code Copy code
Sub ShowObjectsToolbar

 With CommandBars("Objects")
 .Visible = True
 .Position = msoBarBottom
 End With

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


ScratchArea Members (Publisher)

 Copy code hover
[image]

ScratchArea Members (Publisher)
Send feedback

Represents the area outside the boundaries of publication pages where layout elements may be stored with no effect on publication output.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Shapes | Returns a Shapes collection that represents all the Shape objects in the specified publication. This collection can contain drawings, shapes, pictures, OLE objects, ActiveX controls, text objects, and callouts.


Font.Position Property (Publisher)

 Copy code hover
[image]

Font.Position Property (Publisher)
Send feedback

Returns or sets a Variant representing the font position relative to the baseline of the text in the specified range. Positive values move the text above the normal baseline, negative values move the text below the baseline. Indeterminate values are returned as -9999.0. Read/write.

Syntax

expression .Position

expression A variable that represents a Font object.

Example

This example adjusts the text in the second story to 5 points below the baseline.

Copy code Copy code
Sub Position()

 Application.ActiveDocument.Stories(2).TextRange.Font.Position = -5

End Sub


Document.Wizard Property (Publisher)

 Copy code hover
[image]

Document.Wizard Property (Publisher)
Send feedback

Returns a Wizard object representing the publication design associated with the specified publication or the wizard associated with the specified Design Gallery object.

Syntax

expression .Wizard

expression A variable that represents a Document object.

Remarks

When accessing the Wizard property from the Document or Page object, if the specified publication is not associated with any publication design, an error occurs. When accessing the Wizard property from the Shape or ShapeRange object, if the specified object is not a Design Gallery object, an error occurs.

Example

The following example reports on the publication design associated with the active publication, displaying its name and current settings.

Copy code Copy code
Dim wizTemp As Wizard
Dim wizproTemp As WizardProperty
Dim wizproAll As WizardProperties

Set wizTemp = ActiveDocument.Wizard

With wizTemp
 Set wizproAll = .Properties
 Debug.Print "Publication design associated with " _
 & "current publication: " _
 & .Name
 For Each wizproTemp In wizproAll
 With wizproTemp
 Debug.Print " Setting: " _
 & .Name & " = " & .CurrentValueId
 End With
 Next wizproTemp
End With
Note Note

Depending on the language version of Publisher that you are using, you may receive an error when using the above code. If this occurs, you will need to build in error handlers to circumvent the errors. For more information, see Wizard object .


TabStops Methods (Publisher)

 Copy code hover
[image]

TabStops Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Add | Adds a new tab stop to the specified TabStops collection.
ClearAll | Clears all the custom tab stops from the specified paragraphs.
Item | Returns an individual object in a specified collection.


View.ActivePage Property (Publisher)

 Copy code hover
[image]

View.ActivePage Property (Publisher)
Send feedback

Returns a Page object that represents the page currently displayed in the Microsoft Publisher window.

Syntax

expression .ActivePage

expression A variable that represents a View object.

Return Value

Page

Example

This example saves the active page as a JPEG picture. (Note that PathToFile must be replaced with a valid file path for this example to work.)

Copy code Copy code
Sub SavePageAsPicture()
 ActiveView.ActivePage.SaveAsPicture _
 FileName:="PathToFile"
End Sub

This example adds a horizontal ruler guide and a vertical ruler guide to the active page that intersect at the center point of the page.

Copy code Copy code
Sub SetRulerGuidesOnActivePage()
 Dim intHeight As Integer
 Dim intWidth As Integer

 With ActiveView.ActivePage
 intHeight = .Height / 2
 intWidth = .Width / 2
 With .RulerGuides
 .Add Position:=intHeight, Type:=pbRulerGuideTypeHorizontal
 .Add Position:=intWidth, Type:=pbRulerGuideTypeVertical
 End With
 End With
End Sub


ShapeRange.Regroup Method (Publisher)

 Copy code hover
[image]

ShapeRange.Regroup Method (Publisher)
Send feedback

Regroups the group that the specified shape range belonged to previously. Returns the regrouped shapes as a single Shape object.

Syntax

expression .Regroup

expression A variable that represents a ShapeRange object.

Return Value

Shape

Remarks

The Regroup method only restores the group for the first previously grouped shape it finds in the specified ShapeRange collection. Therefore, if the specified shape range contains shapes that previously belonged to different groups, only one of the groups will be restored.

An error occurs if none of the shapes in the specified range were previously members of a group.

Because a group of shapes is treated as a single shape, grouping and ungrouping shapes changes the number of items in the Shapes collection and changes the index numbers of items that come after the affected items in the collection.

Example

This example regroups the selected shapes in the active publication. If the shapes haven't been previously grouped and ungrouped, this example will fail.

Copy code Copy code
ActiveDocument.Selection.ShapeRange.Regroup


FreeformBuilder.AddNodes Method (Publisher)

 Copy code hover
[image]

FreeformBuilder.AddNodes Method (Publisher)
Send feedback

Inserts a new segment at the end of the freeform that is being created, and adds the nodes that define the segment. You can use this method as many times as you want to add nodes to the freeform you are creating. When you finish adding nodes, use the ConvertToShape method to create the freeform you just defined.

Syntax

expression .AddNodes(SegmentType, EditingType, X1, Y1, X2, Y2, X3, Y3)

expression A variable that represents a FreeformBuilder object.

Parameters

Name | Required/Optional | Data Type | Description
SegmentType | Required | MsoSegmentType | The type of segment to be added.
EditingType | Required | MsoEditingType | Specifies the editing type of the new node. If SegmentType is msoSegmentLine, EditingType must be msoEditingAuto; otherwise, an error occurs.
X1 | Required | Variant | If the EditingType of the new segment is msoEditingAuto, this argument specifies the horizontal distance from the upper-left corner of the page to the endpoint of the new segment. If the EditingType of the new node is msoEditingCorner, this argument specifies the horizontal distance from the upper-left corner of the page to the first control point for the new segment.
Y1 | Required | Variant | If the EditingType of the new segment is msoEditingAuto, this argument specifies the vertical distance from the upper-left corner of the page to the endpoint of the new segment. If the EditingType of the new node is msoEditingCorner, this argument specifies the vertical distance from the upper-left corner of the page to the first control point for the new segment.
X2 | Optional | Variant | If the EditingType of the new segment is msoEditingCorner, this argument specifies the horizontal distance from the upper-left corner of the page to the second control point for the new segment. If the EditingType of the new segment is msoEditingAuto, do not specify a value for this argument.
Y2 | Optional | Variant | If the EditingType of the new segment is msoEditingCorner, this argument specifies the vertical distance from the upper-left corner of the page to the second control point for the new segment. If the EditingType of the new segment is msoEditingAuto, do not specify a value for this argument.
X3 | Optional | Variant | If the EditingType of the new segment is msoEditingCorner, this argument specifies the horizontal distance from the upper-left corner of the page to the endpoint of the new segment. If the EditingType of the new segment is msoEditingAuto, do not specify a value for this argument.
Y3 | Optional | Variant | If the EditingType of the new segment is msoEditingAuto, this argument specifies the vertical distance from the upper-left corner of the page to the endpoint of the new segment. If the EditingType of the new segment is msoEditingAuto, do not specify a value for this argument.

Remarks

SegmentType can be one of these MsoSegmentType constants.

msoSegmentCurve

msoSegmentLine

EditingType can be one of these MsoEditingType constants.

msoEditingAuto | Adds a node type appropriate to the segments being connected.
msoEditingCorner | Adds a corner node.

For the X1, Y1, X2, Y2, X3, and Y3 arguments, numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

To add nodes to a freeform after iit is created, use the Insert method of the ShapeNodes collection.

Example

This example adds a freeform with four vertices to the first page in the active publication.

VBA Copy code Copy code
' Add a new freeform object.
With ActiveDocument.Pages(1).Shapes _
 .BuildFreeform(EditingType:=msoEditingCorner, _
 X1:=100, Y1:=100)

 ' Add three more nodes and close the polygon.
 .AddNodes SegmentType:=msoSegmentCurve, _
 EditingType:=msoEditingCorner, _
 X1:=200, Y1:=200, X2:=225, Y2:=250, X3:=250, Y3:=200
 .AddNodes SegmentType:=msoSegmentCurve, _
 EditingType:=msoEditingAuto, X1:=200, Y1:=100
 .AddNodes SegmentType:=msoSegmentLine, _
 EditingType:=msoEditingAuto, X1:=150, Y1:=50
 .AddNodes SegmentType:=msoSegmentLine, _
 EditingType:=msoEditingAuto, X1:=100, Y1:=100

 ' Convert the polygon to a Shape object.
 .ConvertToShape
End With


ShapeNode.Points Property (Publisher)

 Copy code hover
[image]

ShapeNode.Points Property (Publisher)
Send feedback

Gets the x- and y- coordinates of the shape node. Read-only.

Syntax

expression .Points

expression A variable that represents a ShapeNode object.

Remarks

This property is read-only. Use the SetPosition method to set the location of the node.

Example

This example moves node two in shape one on the first page of the active publication to the right 200 points and down 300 points. For this example to work, shape one must be a freeform drawing.

VBA Copy code Copy code
Sub SetPointsPosition()
 Dim varArray As Variant
 Dim intX As Integer
 Dim intY As Integer
 With ActiveDocument.Pages(1).Shapes(1).Nodes
 varArray = .Item(2).Points
 intX = varArray(1, 1)
 intY = varArray(1, 2)
 .SetPosition Index:=2, X1:=intX + 200, Y1:=intY + 300
 End With
End Sub


PictureFormat.OriginalFileSize Property (Publisher)

 Copy code hover
[image]

PictureFormat.OriginalFileSize Property (Publisher)
Send feedback

Returns a Long representing the size, in bytes, of the linked picture or OLE object. Read-only.

Syntax

expression .OriginalFileSize

expression A variable that represents an PictureFormat object.

Remarks

This property only applies to linked pictures. Returns "Permission Denied" for shapes representing embedded or pasted pictures.

Use either of the following properties to determine whether a shape represents a linked picture:

  • The Type property of the Shape object

  • The IsLinked property of the PictureFormat object

Example

The following example tests each picture in the active publication, and prints selected image properties for pictures that are linked.

VBA Copy code Copy code
Dim pgLoop As Page
Dim shpLoop As Shape

For Each pgLoop In ActiveDocument.Pages
 For Each shpLoop In pgLoop.Shapes
 If shpLoop.Type = pbLinkedPicture Then

 With shpLoop.PictureFormat

 Debug.Print "File Name: " & .Filename
 Debug.Print "Original File Size: " & .OriginalFileSize & " bytes"

 End With
 End If
 Next shpLoop
Next pgLoop


WebNavigationBarSet Methods (Publisher)

 Copy code hover
[image]

WebNavigationBarSet Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
AddToEveryPage | Adds a ShapeRange of type pbWebNavigationBar to each page of the current document.
ChangeOrientation | Sets a PbNavBarOrientation constant that represents the alignment of the navigation bar; vertical or horizontal.
DeleteSetAndInstances | Deletes a Web navigation bar set and all instances of it in the current document.


Page.ReaderSpread Property (Publisher)

 Copy code hover
[image]

Page.ReaderSpread Property (Publisher)
Send feedback

Returns a ReaderSpread object that represents the reader spread of the specified page.

Syntax

expression .ReaderSpread

expression A variable that represents a Page object.

Return Value

ReaderSpread

Example

This example checks to see if the reader spread for the specified page includes less than two pages. If it does, it changes the reader spread to include two pages.

VBA Copy code Copy code
Sub SetFacingPages()
 With ActiveDocument.Pages(2).ReaderSpread
 If .PageCount < 2 Then _
 ActiveDocument.ViewTwoPageSpread = True
 End With
End Sub


BuildingBlock.Type Property (Publisher)

 Copy code hover
[image]

BuildingBlock.Type Property (Publisher)
Send feedback

A PbBuildingBlockType Enumeration (Publisher) value that represents the type of the building block. Read-only.

Syntax

expression .Type

expression A variable that represents a BuildingBlock object.


Hyperlinks.Count Property (Publisher)

 Copy code hover
[image]

Hyperlinks.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a Hyperlinks object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


LineFormat.JoinStyle Property (Publisher)

 Copy code hover
[image]

LineFormat.JoinStyle Property (Publisher)
See also Send feedback

Returns of sets the join style for the specified line. Read-write.

Version Information

Version Added: Publisher 2013

Syntax

expression .JoinStyle

expression A variable that represents a LineFormat object.

Return value

MSOLINEJOINSTYLE

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


TextStyles Properties (Publisher)

 Copy code hover
[image]

TextStyles Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


PrintablePlates Object (Publisher)

 Copy code hover
[image]

PrintablePlates Object (Publisher)
Send feedback

This object or member is deprecated and is not intended to be used in your code.


Shapes.Count Property (Publisher)

 Copy code hover
[image]

Shapes.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a Shapes object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


Document.Open Event (Publisher)

 Copy code hover
[image]

Document.Open Event (Publisher)
Send feedback

Occurs when a publication is opening.

Syntax

expression .Open

expression A variable that represents a Document object.

Remarks

To access the Document object events, declare a Document object variable in the General Declarations section of a class module, then set the variable equal to the Document object for which you want to access events.

For more information about using events with the Document object, see Using Events with the Document Object .

Example

This example displays a message when a publication is opened. (The procedure can be stored in the ThisDocument module of a publication.)

Copy code Copy code
Private Sub Document_Open()
 MsgBox "This publication is copyrighted."
End Sub


CaptionStyles Object (Publisher)

 Copy code hover
[image]

CaptionStyles Object (Publisher)
Send feedback

Represents the collection of all 37 of the CaptionStyle objects available in Microsoft Publisher 2010.


Document.WebPagePreview Method (Publisher)

 Copy code hover
[image]

Document.WebPagePreview Method (Publisher)
Send feedback

Generates a Web page preview of the specified publication in Internet Explorer.

Syntax

expression .WebPagePreview

expression A variable that represents a Document object.

Remarks

A Web preview can be generated for print publications. However, the appearance of the Web preview may differ from the printed publication.

The Web preview opens with the active page displayed. Preview Web pages are generated for each page in the publication. However, if the publication is a print publication or otherwise lacks a navigation bar, there may be no way to navigate to those pages.

Use the PublicationType property to determine if a publication is a print publication or a Web publication.

This method corresponds to the Web Page Preview command on the File menu.

Example

The following example sets the active page of the publication and generates a Web preview of the publication.

Copy code Copy code

With ActiveDocument
 .ActiveView.ActivePage = .Pages(2)
 .WebPagePreview
End With


Shape.MoveOutOfTextFlow Method (Publisher)

 Copy code hover
[image]

Shape.MoveOutOfTextFlow Method (Publisher)
Send feedback

Moves a given inline shape out of its containing text range, defined by TextRange Object, and makes the shape fixed.

Syntax

expression .MoveOutOfTextFlow

expression A variable that represents a Shape object.

Remarks

An automation error is returned if the shape to be moved is not already inline.

After the MoveOutOfTextFlow method is called on an inline shape, the shape will maintain its position on the page, but it will no longer be inline.

Example

The following example moves the first inline shape contained in a given text range out of the text flow.

Copy code Copy code
Dim theShape As Shape

Set theShape = ActiveDocument.Pages(2).Shapes(1) _
 .TextFrame.TextRange.InlineShapes(1)

theShape.MoveOutOfTextFlow


MailMergeDataField Object (Publisher)

 Copy code hover
[image]

MailMergeDataField Object (Publisher)
Send feedback

Represents a single merge field in a data source. The MailMergeDataField object is a member of the MailMergeDataFields collection. The MailMergeDataFields collection includes all the data fields in a mail merge or catalog merge data source (for example, Name, Address, and City).

Remarks

You cannot add fields to the MailMergeDataFields collection. All data fields in a data source are automatically included in the MailMergeDataFields collection.

Example

Use DataFields (index), where index is the data field name or index number, to return a single MailMergeDataField object. The index number represents the position of the data field in the mail merge data source. This example retrieves the name of the first field and value of the first record of the FirstName field in the data source attached to the active publication.

Copy code Copy code
Sub GetDataFromSource()
 With ActiveDocument.MailMerge.DataSource
 MsgBox "Field Name: " & .DataFields.Item(1).Name & _
 "Value: " & .DataFields.Item("FirstName").Value
 End With
End Sub


Plate.Name Property (Publisher)

 Copy code hover
[image]

Plate.Name Property (Publisher)
Send feedback

Returns a String value indicating the name of the specified object. Read-only.

Syntax

expression .Name

expression A variable that represents a Plate object.

Remarks

You can use an object's name in conjunction with the Item method or Item property to return a reference to the object if the Item method or property for the collection that contains the object takes a Variant argument. For example, if the value of the Name property for a shape is Rectangle 2, then .Shapes("Rectangle 2") will return a reference to that shape.

The Name property is the default property for the BorderArt, BorderArtFormat, and Label objects.


Options.MeasurementUnit Property (Publisher)

 Copy code hover
[image]

Options.MeasurementUnit Property (Publisher)
Send feedback

Returns or sets a PbUnitType constant representing the standard measurement unit for Microsoft Publisher. Read/write.

Syntax

expression .MeasurementUnit

expression A variable that represents a Options object.

Return Value

PbUnitType

Remarks

The MeasurementUnit property value can be one of the PbUnitType constants declared in the Publisher type library and shown in the following table.

Constant | Description
pbUnitCM | Sets the unit of measurement to centimeters.
pbUnitEmu | Doesn't apply to this property; returns an error if used..
pbUnitFeet | Doesn't apply to this property; returns an error if used.
pbUnitHa | Doesn't apply to this property; returns an error if used.
pbUnitInch | Sets the unit of measurement to inches.
pbUnitKyu | Doesn't apply to this property; returns an error if used.
pbUnitMeter . | Doesn't apply to this property; returns an error if used.
pbUnitPica | Sets the unit of measurement to picas.
pbUnitPoint | Sets the unit of measurement to points.
pbUnitTwip | Doesn't apply to this property; returns an error if used.

Example

This example sets the standard measurement unit for Publisher to points.

VBA Copy code Copy code
Sub SetUnitOfMeasurement()
 Options.MeasurementUnit = pbUnitPoint
End Sub

This example displays the current unit of measurement.

VBA Copy code Copy code
Sub GetUnitOfMeasurement()
 Dim measUnit As PbUnitType
 Dim strUnit As String

 measUnit = Options.MeasurementUnit

 Select Case measUnit
 Case 0
 strUnit = "inches"
 Case 1
 strUnit = "centimeters"
 Case 2
 strUnit = "picas"
 Case 3
 strUnit = "points"
 End Select

 MsgBox "The current unit of measurement is " & strUnit

End Sub


LayoutGuides.VerticalBaseLineSpacing Property (Publisher)

 Copy code hover
[image]

LayoutGuides.VerticalBaseLineSpacing Property (Publisher)
Send feedback

Returns a Single that represents the vertical baseline spacing of the specified LayoutGuides object. Read/write.

Syntax

expression .VerticalBaseLineSpacing

expression A variable that represents a LayoutGuides object.

Return Value

Single

Remarks

When setting the layout guide properties of a Page object it must be returned from the MasterPages collection.

Example

This example sets the vertical baseline spacing of the LayoutGuides object to 12 for the second master page in the active document.

VBA Copy code Copy code
Dim objLayout As LayoutGuides
Set objLayout = ActiveDocument.MasterPages(2).LayoutGuides
objLayout.VerticalBaseLineSpacing = 12


WebTextBox.Application Property (Publisher)

 Copy code hover
[image]

WebTextBox.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a WebTextBox object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


ShapeRange Members (Publisher)

 Copy code hover
[image]

ShapeRange Members (Publisher)
Send feedback

Represents a shape range, which is a set of shapes on a document. A shape range can contain as few as one shape or as many as all the shapes in the document. You can include whichever shapes you want — chosen from among all the shapes in the document or all the shapes in the selection — to construct a shape range. For example, you could construct a ShapeRange collection that contains the first three shapes in a document, all the selected shapes in a document, or all the freeform shapes in a document.

Methods

Name | Description
AddToCatalogMergeArea | Adds the specified shape or shapes to the publication page's catalog merge area.
Align | Aligns all the shapes in the specified ShapeRange object.
Apply | Applies formatting copied from another shape or shape range using the PickUp method.
Copy | Copies the specified object to the Clipboard.
Cut | Deletes the specified object and places it on the Clipboard.
Delete | Deletes the specified object.
Distribute | Evenly distributes the shapes in the specified shape range.
Duplicate | Creates a duplicate of the specified Shape or ShapeRange object, adds the new shape or range of shapes to the Shapes collection immediately after the shape or range of shapes specified originally, and then returns the new Shape or ShapeRange object.
Flip | Flips the specified shape around its horizontal or vertical axis, or flips all the shapes in the specified shape range around their horizontal or vertical axes.
GetHeight | Returns the height of the shape or shape range as a Single in the specified units.
GetLeft | Returns the distance of the shape's or shape range's left edge from the left edge of the leftmost page in the current view as a Single in the specified units.
GetTop | Returns the distance of the shape's or shape range's top edge from the top edge of the leftmost page in the current view as a Single in the specified units.
GetWidth | Returns the width of the shape or shape range as a Single in the specified units. .
Group | Groups the shapes in the specified shape range. Returns the grouped shapes as a single Shape object.
IncrementLeft | Moves the specified shape or shape range horizontally by the specified distance.
IncrementRotation | Changes the rotation of the specified shape around the z-axis (extends outward from the plane of the publication) by the specified number of degrees.
IncrementTop | Moves the specified shape or shape range vertically by the specified distance.
Item | Returns an individual object in a specified collection.
MoveIntoTextFlow | Moves a given shape into the text flow defined by TextRange Object. The shape will always be inserted inline at the beginning of the text flow.
MoveOutOfTextFlow | Moves a given inline shape out of its containing text range, defined by TextRange Object, and makes the shape fixed.
PickUp | Copies formatting from a shape or shape range so that it can be copied to another shape or shape range using the Apply method.
Regroup | Regroups the group that the specified shape range belonged to previously. Returns the regrouped shapes as a single Shape object.
RemoveFromCatalogMergeArea | Removes a shape from the specified page's catalog merge area. Removed shapes are not deleted, but instead remain in place on the page containing the catalog merge area.
RerouteConnections | Reroutes connectors so that they take the shortest possible path between the shapes they connect. To do this, the RerouteConnections method may detach the ends of a connector and reattach them to different connecting sites on the connected shapes.
SaveAsBuildingBlock | Saves a single shape range as a building block. Returns the resulting BuildingBlock object.
SaveAsPicture | Saves a range of one or more shapes as a picture file.
ScaleHeight | Scales the height of the shape by a specified factor. For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original size or relative to the current size.
ScaleWidth | Scales the width of the shape by a specified factor. For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original size or relative to the current size.
Select | Selects the specified object.
SetShapesDefaultProperties | Applies the formatting for the specified shape or shape range to the default shape. Shapes created after this method has been used will have this formatting applied to them by default.
Ungroup | Ungroups the specified group of shapes or any groups of shapes in the specified shape range. If the specified shape is a picture or OLE object, Microsoft Publisher will break it apart and convert it to an ungrouped set of shapes. (For example, an embedded Microsoft Excel spreadsheet is converted into lines and text boxes.) Returns the ungrouped shapes as a single ShapeRange object.
ZOrder | Moves the specified shape in front of or behind other shapes in the collection (that is, changes the shape's position in the z-order).

Properties

Name | Description
Adjustments | Returns an Adjustments collection representing all adjustment handles for the specified Shape or ShapeRange object.
AlternativeText | Returns or sets a String representing the text displayed by a Web browser in place of the Shape object while the Shape object is being downloaded or when graphics are turned off. Read/write.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
AutoShapeType | Returns or sets an MsoAutoShapeType constant that specifies a ShapeRange object's AutoShape type.
BlackWhiteMode | Returns or sets an MsoBlackWhiteMode constant indicating how the specified shape or shape range appears when the publication is viewed in black-and-white mode. Read/write.
Callout | Returns a CalloutFormat object representing the formatting of a line callout.
ConnectionSiteCount | Returns a Long indicating the count of connection sites on the current Shape object. Read-only.
Connector | Returns an MsoTriState value indicating whether the specified shape is a connector. Read-only.
ConnectorFormat | Returns a ConnectorFormat object that contains connector formatting properties. Applies to Shape or ShapeRange objects that represent connectors.
Count | Returns a Long that represents the number of items in the specified collection.
Fill | Returns a FillFormat object representing the fill for the specified shape or table cell.
Glow | Returns a GlowFormat object that represents the glow formatting for a range of shapes. Read-only.
GroupItems | Returns a GroupShapes collection if the specified shape is a group.
HasTable | Returns msoTrue if the shape represents a TableFrame object or msoFalse if the shape represents any other object type. Read-only.
HasTextFrame | Indicates whether the specified shape has a TextFrame object associated with it. Read-only.
Height | Returns a Variant that represents the height (in points) of a specified range of shapes. Read-only.
HorizontalFlip | Indicates whether the specified shape has been flipped around its horizontal axis. Read-only.
Hyperlink | Returns a Hyperlink object representing the hyperlink associated with the specified shape.
ID | Returns a Long that represents the type of a shape, range of shapes, or property, type, or value of a wizard. Read-only.
InlineAlignment | Returns or sets a PbInlineAlignment constant that indicates whether an inline shape has left, right, or in-text alignment. Read/write.
InlineTextRange | Returns a TextRange object that reflects the position of the inline shape in its containing text range. Read-only.
IsInline | Returns an MsoTriState constant that specifies whether a shape is inline. Read-only.
Left | Returns a Variant indicating the distance from the left edge of the page to the leftmost edge of all the shapes in the specified shape range. Numeric values are in points; all other values are in any measurement supported by Publisher (for example, "2.5 in"). Read-only.
Line | Returns a LineFormat object that contains line formatting properties for the specified shape. (For a line, the LineFormat object represents the line itself; for a shape with a border, the LineFormat object represents the border.).
LinkFormat | Returns a LinkFormat object that contains the properties that are unique to linked OLE objects. Read-only.
LockAspectRatio | Returns or sets an MsoTriState constant indicating whether the specified shape retains its original proportions when you resize it. Read/write.
Name | Returns or sets a String value indicating the name of the specified object. Read/write.
Nodes | Returns a ShapeNodes collection that represents the geometric description of the specified shape. Applies to Shape or ShapeRange objects that represent freeform drawings.
OLEFormat | Returns an OLEFormat object that contains OLE formatting properties for the specified shape. Applies to Shape or ShapeRange objects that represent OLE objects.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
PictureFormat | Returns a PictureFormat object that contains picture formatting properties for the specified object. Applies to Shape or ShapeRange objects that represent pictures or OLE objects. Read-only.
Reflection | Returns a ReflectionFormat object that represents the reflection formatting for a range of shapes. Read-only.
Rotation | Returns or sets a Single that represents the number of degrees the specified shape is rotated around the z-axis. A positive value indicates clockwise rotation; a negative value indicates counterclockwise rotation. Read/write.
Shadow | Returns a ShadowFormat object that represents the shadow formatting for the specified shape.
SoftEdge | Returns a SoftEdgeFormat object that represents the soft edge formatting for a range of shapes. Read-only.
Table | Returns a Table object that represents a table in Microsoft Publisher.
Tags | Returns a Tags collection representing tags or custom properties applied to a shape, shape range, page, or publication.
TextEffect | Returns a TextEffectFormat object that represents the text formatting properties of a WordArt object.
TextFrame | Returns a TextFrame object that represents the text in a shape and the properties that control the margins and orientation of the text.
TextWrap | Returns a WrapFormat object that represents the properties for wrapping text around a shape or shape range.
ThreeD | Returns a ThreeDFormat object.
Top | Returns a Variant that represents the distance between the top of the page and the top shape in a range of shapes. Read-only.
Type | Specifies the shape type. Read-only.
VerticalFlip | Returns msoTrue if the specified shape has been flipped around its vertical axis. Read-only.
Vertices | Returns the coordinates of the specified freeform drawing's vertices (and control points for Bézier curves) as a series of coordinate pairs. Read-only Variant.
Width | Returns a Variant that represents the width (in points) of a specified range of shapes. Read-only.
Wizard | Returns a Wizard object representing the publication design associated with the specified publication or the wizard associated with the specified Design Gallery object.
WizardTag | Returns or sets a PbWizardTag constant indicating the function of a specified shape with respect to its publication design. Read/write.
WizardTagInstance | Returns or sets a Long indicating the instance of the specified shape compared with other shapes having the same wizard tag. Read/write.
ZOrderPosition | Returns a Long indicating the position of the specified shape or shape range in the z-order. Read-only.


RulerGuide Members (Publisher)

 Copy code hover
[image]

RulerGuide Members (Publisher)
Send feedback

Represents a gridline used to align objects on a page. The RulerGuide object is a member of the RulerGuides collection.

Methods

Name | Description
Delete | Deletes the specified object.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Position | Returns or sets a Variant representing the font position relative to the baseline of the text in the specified range. Positive values move the text above the normal baseline, negative values move the text below the baseline. Indeterminate values are returned as -9999.0. Read/write.
Type | Returns or sets a PbRulerGuideType constant that represents the ruler guide type. Read/write.


Font.TextShadow Property (Publisher)

 Copy code hover
[image]

Font.TextShadow Property (Publisher)
See also Send feedback

Returns a ShadowFormat object that specifies the shadow formatting for the specified font.

Version Information

Version Added: Publisher 2013

Syntax

expression .TextShadow

expression A variable that represents a Font object.

Return value

SHADOWFORMAT

See also

Concepts

Font Object

Other resources

Font Object Members


EmailMergeEnvelope.Attachemts Property (Publisher)

 Copy code hover
[image]

EmailMergeEnvelope.Attachemts Property (Publisher)
Send feedback

Gets the list of a merged e-mail message's attachments. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .Attachemts

expression A variable that represents an EmailMergeEnvelope object.

Return Value

Attachments

Remarks

To add attachments to a merged e-mail message, use the Add method of the Attachment object. To remove an attachment, use the Attachment.Delete method; to remove all attachments, use the ClearAll method of the Attachments collection.


ShapeRange.ScaleHeight Method (Publisher)

 Copy code hover
[image]

ShapeRange.ScaleHeight Method (Publisher)
Send feedback

Scales the height of the shape by a specified factor. For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original size or relative to the current size.

Syntax

expression .ScaleHeight(Factor, RelativeToOriginalSize, fScale)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Factor | Required | Single | Specifies the ratio between the height of the shape after you resize it and the current or original height. For example, to make a rectangle 50 percent larger, specify 1.5 for this argument.
RelativeToOriginalSize | Required | MsoTriState | Specifies whether to scale relative to the object's original or current size.
fScale | Optional | MsoScaleFrom | The part of the shape that retains its position when the shape is scaled.

Remarks

The RelativeToOriginalSize parameter can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | Scales the shape relative to its current size.
msoTrue | Scales the shape relative to its original size.

The fScale parameter can be one of the MsoScaleFrom constants declared in the Microsoft Office type library and shown in the following table. The default is msoScaleFromTopLeft.

msoScaleFromBottomRight

msoScaleFromMiddle

msoScaleFromTopLeft

Shapes other than pictures and OLE objects are always scaled relative to their current height; specifying a RelativeToOriginalSize value of msoTrue for shapes other than pictures or OLE objects causes an error.

Use the ScaleWidth method to scale the width of a shape.

Example

This example scales all pictures and OLE objects on the first page of the active publication to 175 percent of their original height and width, and it scales all other shapes to 175 percent of their current height and width.

VBA Copy code Copy code
' Looping variable.
Dim shpLoop As Shape

' Loop through all the shapes on the first page.
For Each shpLoop In ActiveDocument.Pages(1).Shapes
 With shpLoop
 Select Case .Type
 ' If the shape is a picture or OLE object,
 ' scale relative to original size.
 Case pbPicture, pbLinkedPicture, _
 pbEmbeddedOLEObject, pbLinkedOLEObject, _
 pbOLEControlObject
 .ScaleHeight Factor:=1.75, _
 RelativeToOriginalSize:=True
 .ScaleWidth Factor:=1.75, _
 RelativeToOriginalSize:=True
 ' If the shape is not a picture or OLE object,
 ' scale relative to the current size.
 Case Else
 .ScaleHeight Factor:=1.75, _
 RelativeToOriginalSize:=False
 .ScaleWidth Factor:=1.75, _
 RelativeToOriginalSize:=False
 End Select
 End With
Next shpLoop


MailMergeDataField.Insert Method (Publisher)

 Copy code hover
[image]

MailMergeDataField.Insert Method (Publisher)
Send feedback

Returns a Shape object that represents a data field inserted into a publication.

Syntax

expression .Insert(Range)

expression A variable that represents a MailMergeDataField object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Optional | TextRange | The text range to insert.

Return Value

Shape

Remarks

The Insert method works for both picture and string (text) fields.

Note Note

You can also use the InsertMailMergeField method of the TextRange object to add a text data field to a text box in the publication's catalog merge area.

Example

This example defines a data field as a picture data field, inserts it into the catalog merge area of the specified publication, and sizes and positions the picture data field. This example assumes the publication has been connected to a data source, and a catalog merge area has been added to the publication.

VBA Copy code Copy code
Dim pbPictureField1 As Shape

 'Define the field as a picture data type
 With ThisDocument.MailMerge.DataSource.DataFields
 .Item("Photo:").FieldType = pbMailMergeDataFieldPicture
 End With

 'Insert a picture field, and then size and position it
 Set pbPictureField1 = ThisDocument.MailMerge.DataSource.DataFields.Item("Photo:").Insert
 With pbPictureField1
 .Height = 100
 .Width = 100
 .Top = 85
 .Left = 375
 End With


TextFrame.MarginBottom Property (Publisher)

 Copy code hover
[image]

TextFrame.MarginBottom Property (Publisher)
Send feedback

Returns or sets a Variant that represents the amount of space (in points) between the text and the bottom edge of a cell, text frame, or page. Read/write.

Syntax

expression .MarginBottom

expression A variable that represents a TextFrame object.

Example

This example sets the margins of the active publication to two inches.

Copy code Copy code
Sub SetPageMargins()

 With ActiveDocument.LayoutGuides
 .MarginTop = Application.InchesToPoints(Value:=2)
 .MarginBottom = Application.InchesToPoints(Value:=2)
 .MarginLeft = Application.InchesToPoints(Value:=2)
 .MarginRight = Application.InchesToPoints(Value:=2)
 End With

End Sub


DropCap.FontItalic Property (Publisher)

 Copy code hover
[image]

DropCap.FontItalic Property (Publisher)
Send feedback

Sets or returns an MsoTriState constant that represents whether the font for a dropped capital letter or WordArt text effect is italic. Read/write.

Syntax

expression .FontItalic

expression A variable that represents a DropCap object.

Remarks

The FontItalic property value can be one of the MsoTriState constants declared in the Microsoft Office type library.

Example

This example makes the dropped capital letter in the specified text frame italic. This example assumes that the specified text frame is formatted with a dropped capital letter.

VBA Copy code Copy code
Sub BoldDropCap()
 With ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.DropCap
 .FontBold = msoTrue
 .FontColor.RGB = RGB(Red:=150, Green:=50, Blue:=180)
 .FontItalic = msoTrue
 .FontName = "Script MT Bold"
 End With
End Sub


WebListBox Properties (Publisher)

 Copy code hover
[image]

WebListBox Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
ListBoxItems | Returns a WebListBoxItems object that represents the items in a Web list box control.
MultiSelect | Specifies whether a user may select more than one item in a Web list box control. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
ReturnDataLabel | Returns or sets a String that represents the text used by the Web page to label the specified Web object when the page is submitted. Read/write.


PbUnderlineType Enumeration (Publisher)

 Copy code hover
[image]

PbUnderlineType Enumeration (Publisher)
Send feedback

Indicates the type of underline for the selected characters in the specified font in a text range.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbUnderlineDash | 6 | Dash
pbUnderlineDashHeavy | 12 | Dash Heavy
pbUnderlineDashLong | 15 | Dash Long
pbUnderlineDashLongHeavy | 16 | Dash Long Heavy
pbUnderlineDotDash | 7 | Dot Dash
pbUnderlineDotDashHeavy | 13 | Dot Dash Heavy
pbUnderlineDotDotDash | 8 | Dot Dot Dash
pbUnderlineDotDotDashHeavy | 14 | Dot Dot Dash Heavy
pbUnderlineDotHeavy | 11 | Dot Heavy
pbUnderlineDotted | 4 | Dotted
pbUnderlineDouble | 3 | Double
pbUnderlineMixed | -1 | Mixed
pbUnderlineNone | 0 | None
pbUnderlineSingle | 1 | Single
pbUnderlineThick | 5 | Thick
pbUnderlineWavy | 9 | Wavy
pbUnderlineWavyDouble | 17 | Wavy Double
pbUnderlineWavyHeavy | 10 | Wavy Heavy
pbUnderlineWordsOnly | 2 | Words Only


ShapeRange.GetHeight Method (Publisher)

 Copy code hover
[image]

ShapeRange.GetHeight Method (Publisher)
Send feedback

Returns the height of the shape or shape range as a Single in the specified units.

Syntax

expression .GetHeight(Unit)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Required | PbUnitType | The units in which to return the height.

Return Value

Single

Remarks

The Unit parameter can be one of the PbUnitType constants declared in the Microsoft Publisher type library.

Use the GetWidth method to return the width of a shape or shape range.

Example

The following example displays the height and width in inches (to the nearest hundredth) of the shape range consisting of all the shapes on the first page of the active publication.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes.Range
 MsgBox "Height of all shapes: " _
 & Format(.GetHeight(Unit:=pbUnitInch), "0.00") _
 & " in" & vbCr _
 & "Width of all shapes: " _
 & Format(.GetWidth(Unit:=pbUnitInch), "0.00") _
 & " in"
End With


PictureFormat.IsTrueColor Property (Publisher)

 Copy code hover
[image]

PictureFormat.IsTrueColor Property (Publisher)
Send feedback

Returns an MsoTriState constant indicating whether the specified picture or OLE object contains color data of 24 bits per channel or greater. Read-only.

Syntax

expression .IsTrueColor

expression A variable that represents an PictureFormat object.

Return Value

MsoTriState

Remarks

For pictures that are not TrueColor, use the ColorsInPalette property of the PictureFormat object to determine the number of colors in the picture's palette.

The IsTrueColor property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The specified picture does not contain color data of 24 bits per channel or greater.
msoTriStateMixed | Return value indicating a combination of msoTrue and msoFalse for the specified shape range.
msoTrue | The specified picture contains color data of 24 bits per channel or greater.

Example

The following example tests each picture in the active document and prints whether the picture is TrueColor. If it is not TrueColor, the example prints how many colors are in the picture's palette.

VBA Copy code Copy code
For Each pgLoop In ActiveDocument.Pages
 For Each shpLoop In pgLoop.Shapes
 If shpLoop.Type = pbLinkedPicture Or shpLoop.Type = pbPicture Then

 With shpLoop.PictureFormat
 If .IsEmpty = msoFalse Then
 Debug.Print .Filename
 If .IsTrueColor = msoTrue Then
 Debug.Print "This picture is TrueColor"
 Else
 Debug.Print "This picture contains " & .ColorsInPalette & " colors."
 End If
 End If
 End With

 End If
 Next shpLoop
Next pgLoop


MailMergeDataSources.Parent Property (Publisher)

 Copy code hover
[image]

MailMergeDataSources.Parent Property (Publisher)
Send feedback

Returns the parent of the MailMergeDataSources collection. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .Parent

expression A variable that represents a MailMergeDataSources collection.

Return Value

Object


Shape.GetTop Method (Publisher)

 Copy code hover
[image]

Shape.GetTop Method (Publisher)
Send feedback

Returns the distance of the shape's or shape range's top edge from the top edge of the leftmost page in the current view as a Single in the specified units.

Syntax

expression .GetTop(Unit)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Required | PbUnitType | The units in which to return the distance.

Return Value

Single

Remarks

The Unit parameter can be one of the PbUnitType constants declared in the Microsoft Publisher type library.

Use the GetLeft method to return the distance of a shape's or shape range's left edge from the left edge of the leftmost page in the current view.

Example

The following example displays the distances from the left and top edges of the leftmost page to the left and top edges of shape range consisting of all the shapes on the first page. The distances are expressed in inches (to the nearest hundredth).

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes.Range
 MsgBox "Distance from left: " _
 & Format(.GetLeft(Unit:=pbUnitInch), "0.00") _
 & " in" & vbCr _
 & "Distance from top: " _
 & Format(.GetTop(Unit:=pbUnitInch), "0.00") _
 & " in"
End With


Document.EnvelopeVisible Property (Publisher)

 Copy code hover
[image]

Document.EnvelopeVisible Property (Publisher)
Send feedback

Returns or sets a Boolean indicating whether the e-mail message header is visible in the publication window. Read/write.

Syntax

expression .EnvelopeVisible

expression A variable that represents an Document object.

Return Value

Boolean

Example

This example displays the e-mail message header for the active publication.

Copy code Copy code
ActiveDocument.EnvelopeVisible = True


MailMergeDataField.MappedTo Property (Publisher)

 Copy code hover
[image]

MailMergeDataField.MappedTo Property (Publisher)
Send feedback

Returns the name of the recipient field (column) in the master data source (combined mail-merge recipient list) that the parent MailMergeDataField object is mapped to. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .MappedTo

expression A variable that represents a MailMergeDataField object.

Return Value

String

Remarks

The parent MailMergeDataField object must represent a field (column) in a connected data source that is not the master data source (the combination of all connected data sources). The MappedTo property is not available for data fields in the data source represented by the DataSource property of the MailMerge object of the active Document object (ThisDocument.MailMerge.DataSource).


ShapeRange.Table Property (Publisher)

 Copy code hover
[image]

ShapeRange.Table Property (Publisher)
Send feedback

Returns a Table object that represents a table in Microsoft Publisher.

Syntax

expression .Table

expression A variable that represents a ShapeRange object.

Example

The following example adds a 5x5 table on the first page of the active publication, and then selects the first column of the new table.

VBA Copy code Copy code
Sub NewTable()
 With ActiveDocument.Pages(1).Shapes.AddTable(NumRows:=5, _
 NumColumns:=5, Left:=72, Top:=300, Width:=400, Height:=100)
 .Table.Columns(3).Cells(3).Fill.ForeColor.RGB = RGB _
 (Red:=255, Green:=0, Blue:=0)
 End With
End Sub

The following example selects the specified table in the active publication. This example assumes that there is at least one shape on the first page of the active publication.

VBA Copy code Copy code
Sub SelectTable()
 With ActiveDocument.Pages(1).Shapes(1)
 If .Type = pbTable Then
 .Table.Rows(3).Cells(3).Fill.ForeColor _
 .RGB = RGB(Red:=150, Green:=150, Blue:=150)
 End If
 End With
End Sub


CellRange.Column Property (Publisher)

 Copy code hover
[image]

CellRange.Column Property (Publisher)
Send feedback

Returns a Long that represents the table column containing the specified cell. Read-only.

Syntax

expression .Column

expression A variable that represents a CellRange object.

Example

This example adds a page to the active publication, creates a table on that new page, and diagonally splits all cells in even-numbered columns.

VBA Copy code Copy code
Sub CreateNewTable()

 Dim pgeNew As Page
 Dim shpTable As Shape
 Dim tblNew As Table
 Dim celTable As Cell
 Dim rowTable As Row

 'Creates a new document with a five-row by five-column table
 Set pgeNew = ActiveDocument.Pages.Add(Count:=1, After:=1)
 Set shpTable = pgeNew.Shapes.AddTable(NumRows:=5, NumColumns:=5, _
 Left:=72, Top:=72, Width:=468, Height:=100)
 Set tblNew = shpTable.Table

 'Inserts a diagonal split into all cells in even-numbered columns
 For Each rowTable In tblNew.Rows
 For Each celTable In rowTable.Cells
 If celTable.Column Mod 2 = 0 Then
 celTable.Diagonal = pbTableCellDiagonalUp
 End If
 Next celTable
 Next rowTable

End Sub


Tags.Add Method (Publisher)

 Copy code hover
[image]

Tags.Add Method (Publisher)
Send feedback

Adds a new Tag object to the specified Tags object and returns the new Tag object.

Syntax

expression .Add(Name, Value)

expression A variable that represents a Tags object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the tag to add. If a tag already exists with the same name, an error occurs.
Value | Required | Variant | The value to assign to the tag.

Return Value

Tag

Example

The following example adds a tag to shape one on page one of the active publication.

VBA Copy code Copy code
Dim tagNew As Tag

Set tagNew = ActiveDocument.Pages(1).Shapes(1).Tags _
 .Add(Name:="required", Value:="yes")


MailMergeFilterCriterion.Conjunction Property (Publisher)

 Copy code hover
[image]

MailMergeFilterCriterion.Conjunction Property (Publisher)
Send feedback

Returns or sets an MsoFilterConjunction constant that represents how a filter criterion relates to other filter criteria in the MailMergeFilters object. Read/write.

Syntax

expression .Conjunction

expression A variable that represents a MailMergeFilterCriterion object.

Return Value

MsoFilterConjunction

Remarks

The Conjunction property value can be one of the following MsoFilterConjunction constants declared in the Microsoft Office type library.

msoFilterConjunctionAnd

msoFilterConjunctionOr

Example

The following example changes an existing filter to remove from the mail merge all records that do not have a Region field equal to "WA", and then adds the filter to the following filter, so that the the filter criteria must match both filters combined and not just one or the other.

Copy code Copy code
Sub SetQueryCriterion()
 Dim intItem As Integer
 With ActiveDocument.MailMerge.DataSource.Filters
 For intItem = 1 To .Count
 With .Item(intItem)
 If .Column = "Region" Then
 .Comparison = msoFilterComparisonNotEqual
 .CompareTo = "WA"
 If .Conjunction = "Or" Then .Conjunction = "And"
 End If
 End With
 Next
 End With
End Sub


LineFormat.GradientAngle Property (Publisher)

 Copy code hover
[image]

LineFormat.GradientAngle Property (Publisher)
See also Send feedback

Returns or sets the angle of the gradient fill for the specified fill format. Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .GradientAngle

expression A variable that represents a LineFormat object.

Return value

Single

Remarks

A gradient fill can be specified in the formatting for various elements. The valid range of values for the GradientAngle property is from 0 to 359.9.

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


View Properties (Publisher)

 Copy code hover
[image]

View Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
ActivePage | Returns a Page object that represents the page currently displayed in the Microsoft Publisher window.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Zoom | Returns or sets a PbZoom constant or a value between 10 and 400 indicating the zoom setting of the specified view. Read/write.


WebTextBox Properties (Publisher)

 Copy code hover
[image]

WebTextBox Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
DefaultText | Returns or sets a String that represents the default text in a Web text box control. Read/write.
EchoAsterisks | Specifies whether asterisks should be displayed in place of text that is entered into a Web text box control. Read/write.
Limit | Returns or sets a Long that represents the maximum number of characters that can be entered into a Web text box control. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
RequiredControl | Specifies whether an entry into a Web text box control is required. Read/write.
ReturnDataLabel | Returns or sets a String that represents the text used by the Web page to label the specified Web object when the page is submitted. Read/write.


Shape.Wizard Property (Publisher)

 Copy code hover
[image]

Shape.Wizard Property (Publisher)
Send feedback

Returns a Wizard object representing the publication design associated with the specified publication or the wizard associated with the specified Design Gallery object.

Syntax

expression .Wizard

expression A variable that represents a Shape object.

Remarks

When accessing the Wizard property from the Document or Page object, if the specified publication is not associated with any publication design, an error occurs. When accessing the Wizard property from the Shape or ShapeRange object, if the specified object is not a Design Gallery object, an error occurs.

Example

The following example reports on the publication design associated with the active publication, displaying its name and current settings.

Copy code Copy code
Dim wizTemp As Wizard
Dim wizproTemp As WizardProperty
Dim wizproAll As WizardProperties

Set wizTemp = ActiveDocument.Wizard

With wizTemp
 Set wizproAll = .Properties
 Debug.Print "Publication design associated with " _
 & "current publication: " _
 & .Name
 For Each wizproTemp In wizproAll
 With wizproTemp
 Debug.Print " Setting: " _
 & .Name & " = " & .CurrentValueId
 End With
 Next wizproTemp
End With
Note Note

Depending on the language version of Publisher that you are using, you may receive an error when using the above code. If this occurs, you will need to build in error handlers to circumvent the errors. For more information, see Wizard object .


Column.Application Property (Publisher)

 Copy code hover
[image]

Column.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a Column object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


WebNavigationBarSets Properties (Publisher)

 Copy code hover
[image]

WebNavigationBarSets Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


LinkFormat Methods (Publisher)

 Copy code hover
[image]

LinkFormat Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Update | Updates the specified linked OLE object.


PageBackground.Application Property (Publisher)

 Copy code hover
[image]

PageBackground.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a PageBackground object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Fields.Item Method (Publisher)

 Copy code hover
[image]

Fields.Item Method (Publisher)
Send feedback

Returns an individual object in a specified collection.

Syntax

expression .Item(Index)

expression A variable that represents a Fields object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The number of the object to return.

Return Value

Field

Example

This example returns the first field from a Fields object.

VBA Copy code Copy code
Dim fldTemp As Field

Set fldTemp = ActiveDocument.Pages(Index:=1) _
 .Shapes(1).TextFrame.TextRange.Fields.Item(Index:=1)


Documents Methods (Publisher)

 Copy code hover
[image]

Documents Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Add | Adds a new Document object that represents a new publication to the Documents collection.


Pages Members (Publisher)

 Copy code hover
[image]

Pages Members (Publisher)
Send feedback

Represents all the pages in a publication. The Pages collection contains all the Page objects in a publication.

Methods

Name | Description
Add | Adds a new Page object to the specified Pages object and returns the new Page object.
AddWizardPage | Adds the specified new wizard page to a specified location in a publication.
FindByPageID | Returns a Page object that represents the page with the specified page ID number. Each page is automatically assigned a unique ID number when it is created. Use the PageID property to return a page's ID number.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Item | Returns the specified Page object from a Pages or MasterPages collection. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


WebCommandButton.HiddenFields Property (Publisher)

 Copy code hover
[image]

WebCommandButton.HiddenFields Property (Publisher)
Send feedback

Returns a WebHiddenFields object that represents hidden Web fields attached to a Submit command button.

Syntax

expression .HiddenFields

expression A variable that represents a WebCommandButton object.

Return Value

WebHiddenFields

Example

This example adds a new hidden Web field to a new Submit command button.

Copy code Copy code
Sub CreateActionWebButton()
 With ActiveDocument.Pages(1).Shapes
 With .AddWebControl _
 (Type:=pbWebControlCommandButton, Left:=150, _
 Top:=150, Width:=75, Height:=36).WebCommandButton
 .ButtonText = "Submit"
 .ButtonType = pbCommandButtonSubmit
 End With
 .Item(1).WebCommandButton.HiddenFields.Add _
 Name:="User", Value:="PowerUser"
 End With
End Sub


LineFormat.ForeColor Property (Publisher)

 Copy code hover
[image]

LineFormat.ForeColor Property (Publisher)
Send feedback

Returns or sets a ColorFormat object representing the foreground color for the fill, line, or shadow. Read/write.

Syntax

expression .ForeColor

expression A variable that represents a LineFormat object.

Remarks

Use the BackColor property to set the background color for a fill or line.

Example

This example adds a rectangle to the active publication and then sets the foreground color, background color, and gradient for the rectangle's fill.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes.AddShape _
 (Type:=msoShapeRectangle, _
 Left:=90, Top:=90, Width:=90, Height:=50).Fill
 .ForeColor.RGB = RGB(128, 0, 0)
 .BackColor.RGB = RGB(170, 170, 170)
 .TwoColorGradient msoGradientHorizontal, 1
End With

This example adds a patterned line to the active publication.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes.AddLine _
 (BeginX:=10, BeginY:=100, EndX:=250, EndY:=0).Line
 .Weight = 6
 .ForeColor.RGB = RGB(0, 0, 255)
 .BackColor.RGB = RGB(128, 0, 0)
 .Pattern = msoPatternDarkDownwardDiagonal
End With


Plates.Parent Property (Publisher)

 Copy code hover
[image]

Plates.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a Plates object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Shape.IsExcess Property (Publisher)

 Copy code hover
[image]

Shape.IsExcess Property (Publisher)
Send feedback

Indicates whether the parent Shape object is an excess shape after the document template (wizard) is changed by using the Document.ChangeDocument method or by using the Change Template command in the user interface. Microsoft Publisher places any excess shape under Extra Content in the Format Publication task pane. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .IsExcess

expression A variable that represents a Shape object.

Return Value

MsoTriState

Remarks

Publisher classifies a shape as excess (surplus) if that shape does not fit neatly into the new template after the template is changed.


ShapeRange.GetLeft Method (Publisher)

 Copy code hover
[image]

ShapeRange.GetLeft Method (Publisher)
Send feedback

Returns the distance of the shape's or shape range's left edge from the left edge of the leftmost page in the current view as a Single in the specified units.

Syntax

expression .GetLeft(Unit)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Required | PbUnitType | The units in which to return the distance.

Return Value

Single

Remarks

The Unit parameter can be one of the PbUnitType constants declared in the Microsoft Publisher type library.

Use the GetTop method to return the distance of a shape's or shape range's top edge from the top edge of the leftmost page in the current view.

Example

The following example displays the distances from the left and top edges of the leftmost page to the left and top edges of shape range consisting of all the shapes on the first page. The distances are expressed in inches (to the nearest hundredth).

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes.Range
 MsgBox "Distance from left: " _
 & Format(.GetLeft(Unit:=pbUnitInch), "0.00") _
 & " in" & vbCr _
 & "Distance from top: " _
 & Format(.GetTop(Unit:=pbUnitInch), "0.00") _
 & " in"
End With


CatalogMergeShapes Methods (Publisher)

 Copy code hover
[image]

CatalogMergeShapes Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Item | Returns an individual object in a specified collection.
Range | Returns a ShapeRange object that represents a subset of the shapes in a Shapes collection.


Font.GetScriptName Method (Publisher)

 Copy code hover
[image]

Font.GetScriptName Method (Publisher)
Send feedback

Returns a String that represents the name of the font script being used in a text range.

Syntax

expression .GetScriptName(Script)

expression A variable that represents a Font object.

Parameters

Name | Required/Optional | Data Type | Description
Script | Required | PbFontScriptType | The script name.

Return Value

String

Remarks

The Script parameter can be one of the PbFontScriptType constants declared in the Microsoft Publisher type library.

Example

This example verifies that the default font script in use for the specified text range is Tahoma and, if not, sets it as the default font script.

VBA Copy code Copy code
Sub GetScript()
 With ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.Font
 If .GetScriptName(Script:=pbFontScriptDefault) <> "Tahoma" Then
 .SetScriptName Script:=pbFontScriptDefault, _
 FontName:="Tahoma"
 End If
 End With
End Sub


InlineShapes.Range Property (Publisher)

 Copy code hover
[image]

InlineShapes.Range Property (Publisher)
Send feedback

Returns a ShapeRange collection that represents the same set of inline shapes as the InlineShapes collection whose method was called. This allows for miscellaneous formatting of the contained shapes. Read-only.

Syntax

expression .Range(Index)

expression A variable that represents an InlineShapes object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Long | The index position of the inline shape within the ShapeRange collection.

Example

The following example searches through each shape on the first page of the publication, and for all inline shapes within each shape, finds the first inline shape within the range of inline shapes and flips it vertically.

VBA Copy code Copy code
Dim theShape As Shape
Dim theShapes As Shapes

Set theShapes = ActiveDocument.Pages(1).Shapes

For Each theShape In theShapes
 With theShape.TextFrame.TextRange
 .InlineShapes.Range(1).Flip (msoFlipVertical)
 End With
Next


MasterPages Members (Publisher)

 Copy code hover
[image]

MasterPages Members (Publisher)
Send feedback

Represents the page master for a publication after which all pages in the publication will be designed. The MasterPages object is a collection of Page objects.

Methods

Name | Description
Add | Adds a new Page object to the specified MasterPages object and returns the new Page object.
FindByPageID | Returns a Page object that represents the page with the specified page ID number. Each page is automatically assigned a unique ID number when it is created. Use the PageID property to return a page's ID number.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Item | Returns the specified Page object from a Pages or MasterPages collection. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


PbColorType Enumeration (Publisher)

 Copy code hover
[image]

PbColorType Enumeration (Publisher)
Send feedback

Represents the shape color type.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbColorTypeCMS | 4 | CMS
pbColorTypeCMYK | 3 | CMYK
pbColorTypeInk | 5 | Ink
pbColorTypeMixed | -2 | Mixed
pbColorTypeRGB | 1 | RGB
pbColorTypeScheme | 2 | Scheme


Shape.IncrementLeft Method (Publisher)

 Copy code hover
[image]

Shape.IncrementLeft Method (Publisher)
Send feedback

Moves the specified shape or shape range horizontally by the specified distance.

Syntax

expression .IncrementLeft(Increment)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Variant | The horizontal distance to move the shape or shape range. A positive value moves the shape or shape range to the right; a negative value moves it to the left. Numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

Return Value

Nothing

Remarks

Use the IncrementTop method to move shapes or shape ranges vertically.

Example

This example duplicates the first shape on the active publication, sets the fill for the duplicate, moves it 70 points to the right and 50 points up, and rotates it 30 degrees clockwise.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes(1).Duplicate
 .Fill.PresetTextured PresetTexture:=msoTextureGranite
 .IncrementLeft Increment:=70
 .IncrementTop Increment:=-50
 .IncrementRotation Increment:=30
End With


ShapeNode.SegmentType Property (Publisher)

 Copy code hover
[image]

ShapeNode.SegmentType Property (Publisher)
Send feedback

Returns an MsoSegmentType constant that indicates whether the segment associated with the specified node is straight or curved. Read-only.

Syntax

expression .SegmentType

expression A variable that represents a ShapeNode object.

Return Value

MsoSegmentType

Remarks

If the specified node is a control point for a curved segment, this property returns msoSegmentCurve.

Use the SetSegmentType method to set the value of this property.

The SegmentType property value can be one of these MsoSegmentType constants declared in the Microsoft Publisher type library.

msoSegmentCurve

msoSegmentLine

Example

This example changes all straight segments to curved segments in the first shape on the first page of the active publication. For this example to work, the specified shape must be a freeform drawing.

VBA Copy code Copy code
Sub ChangeSegmentTypes()
 Dim intNode As Integer
 With ActiveDocument.Pages(1).Shapes(1).Nodes
 intNode = 1
 Do While intNode <= .Count
 If .Item(intNode).SegmentType = msoSegmentLine Then
 .SetSegmentType Index:=intNode, _
 SegmentType:=msoSegmentCurve
 End If
 intNode = intNode + 1
 Loop
 End With
End Sub


LineFormat.Visible Property (Publisher)

 Copy code hover
[image]

LineFormat.Visible Property (Publisher)
Send feedback

Returns or sets an MsoTriState constant indicating whether the specified object or the formatting applied to the specified object is visible. Read/write.

Syntax

expression .Visible

expression A variable that represents a LineFormat object.

Remarks

The Visible property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The specified object or formatting is not visible.
msoTriStateMixed | Return value only. The specified shape range contains both objects with visible formatting and objects with invisible formatting.
msoTriStateToggle | Set value only. Switches the specified object between visible and invisble.
msoTrue | The specified object or formatting is visible.

Example

This example sets the horizontal and vertical offsets for the shadow of shape three on the first page in the active publication. The shadow is offset 5 points to the right of the shape and 3 points above it. If the shape does not already have a shadow, this example adds one to it.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes(3).Shadow
 .Visible = msoTrue
 .OffsetX = 5
 .OffsetY = -3
End With


Selection Methods (Publisher)

 Copy code hover
[image]

Selection Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Unselect | Cancels the current selection.


MailMergeMappedDataFields Methods (Publisher)

 Copy code hover
[image]

MailMergeMappedDataFields Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Item | Returns an individual object in a specified collection.


MailMergeMappedDataFields.Parent Property (Publisher)

 Copy code hover
[image]

MailMergeMappedDataFields.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a MailMergeMappedDataFields object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


WizardValues Object (Publisher)

 Copy code hover
[image]

WizardValues Object (Publisher)
Send feedback

Represents the complete set of valid values for a wizard property.

Example

Use the Values property of the WizardProperty object to return a WizardValues collection. The following example displays the current value for the first wizard property in the active publication and then lists all the other possible values.

Copy code Copy code
Dim valAll As WizardValues
Dim valLoop As WizardValue

With ActiveDocument.Wizard
 Set valAll = .Properties(1).Values

 MsgBox "Wizard: " & .Name & vbLf & _
 "Property: " & .Properties(1).Name & vbLf & _
 "Current value: " & .Properties(1).CurrentValueId

 For Each valLoop In valAll
 MsgBox "Possible value: " & valLoop.ID & " (" & valLoop.Name & ")"
 Next valLoop
End With


SoftEdgeFormat.Radius Property (Publisher)

 Copy code hover
[image]

SoftEdgeFormat.Radius Property (Publisher)
See also Send feedback

Returns or sets a Single that represents the length of the radius for a soft edge effect. Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .Radius

expression A variable that represents a SoftEdgeFormat object.

Return value

Single

See also

Other resources

SoftEdgeFormat Object
SoftEdgeFormat Object Members


Table Properties (Publisher)

 Copy code hover
[image]

Table Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Cells | Returns a CellRange object that represents a range of cells in a table.
Columns | Returns a Columns collection that represents all the columns of the specified table.
GrowToFitText | True for cells in a table to increase vertically to fit text. Read/write.
Parent | Returns an object that represents the parent object of the specified object. Read-only.
Rows | Returns a Rows collection that represents all the table rows in a range, selection, or table.
TableDirection | Returns or sets a PbTableDirectionType constant that represents whether text in a table is read from left to right or from right to left. Read/write.


Options.DefaultPubDirection Property (Publisher)

 Copy code hover
[image]

Options.DefaultPubDirection Property (Publisher)
Send feedback

Returns or sets a PbDirectionType constant that represents the default direction in which text flows when a new publication is created. Read/write.

Syntax

expression .DefaultPubDirection

expression A variable that represents a Options object.

Return Value

PbDirectionType

Remarks

The DefaultPubDirection property value can be one of the PbDirectionType constants declared in the Microsoft Publisher type library.

This property generates an error if you are not running a bi-directional-enabled version of Microsoft Publisher (for example, Arabic).

Example

This example sets the default direction for new publications and text flow in a bi-directional-enabled version of Publisher.

VBA Copy code Copy code
Sub SetDefaultDirection()
 With Options
 .DefaultPubDirection = pbDirectionRightToLeft
 .DefaultTextFlowDirection = pbDirectionRightToLeft
 End With
End Sub


ColorFormat Object (Publisher)

 Copy code hover
[image]

ColorFormat Object (Publisher)
Send feedback

Represents the color of a one-color object or the foreground or background color of an object with a gradient or patterned fill. You can set colors to an explicit red-green-blue value by using the RGB property.

Remarks

Use one of the properties listed in the following table to return a ColorFormat object.

Use this property | With this object | To return a ColorFormat object that represents this
BackColor | FillFormat | Background fill color (used in a shaded or patterned fill)
ForeColor | FillFormat | Foreground fill color (or the fill color for a solid fill)
BackColor | LineFormat | Background line color (used in a patterned line)
ForeColor | LineFormat | Foreground line color (or the line color for a solid line)
ForeColor | ShadowFormat | Shadow color
ExtrusionColor | ThreeDFormat | Color of the sides of an extruded object

Example

Use the RGB property to set a color to an explicit red-green-blue value. The following example adds a rectangle to the active publication and then sets the foreground color, background color, and gradient for the rectangle's fill.

Copy code Copy code
Sub GradientFill()
 With ActiveDocument.Pages(1).Shapes _
 .AddShape(Type:=msoShapeRectangle, _
 Left:=90, Top:=90, Width:=90, Height:=50).Fill
 .ForeColor.RGB = RGB(128, 0, 0)
 .BackColor.RGB = RGB(170, 170, 170)
 .TwoColorGradient msoGradientHorizontal, 1
 End With
End Sub


Document.ViewVerticalBaseLineGuides Property (Publisher)

 Copy code hover
[image]

Document.ViewVerticalBaseLineGuides Property (Publisher)
Send feedback

Sets or returns a Boolean that represents whether or not the vertical baseline guides are visible in the specified Document object. True if they are visible. False if they are not visible. Read/write.

Syntax

expression .ViewVerticalBaseLineGuides

expression A variable that represents a Document object.

Return Value

Boolean

Remarks

The default setting for this property is False.

Example

The following example makes the vertical baseline guides visible in the active document.

VBA Copy code Copy code
Dim objDocument As Document
Set objDocument = ActiveDocument
objDocument.ViewVerticalBaseLineGuides = True


GroupShapes.Count Property (Publisher)

 Copy code hover
[image]

GroupShapes.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a GroupShapes object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


PhoneticGuide.Text Property (Publisher)

 Copy code hover
[image]

PhoneticGuide.Text Property (Publisher)
Send feedback

Returns a String that represents the contents of phonetic text. Read-only.

Syntax

expression .Text

expression A variable that represents a PhoneticGuide object.


TextRange.LinesCount Property (Publisher)

 Copy code hover
[image]

TextRange.LinesCount Property (Publisher)
Send feedback

Returns the number of lines of text in the text range represented by the parent TextRange object. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .LinesCount

expression A variable that represents a TextRange object.

Return Value

Long


LineFormat.Type Property (Publisher)

 Copy code hover
[image]

LineFormat.Type Property (Publisher)
See also Send feedback

Returns the line fill-format type. Read-only.

Version Information

Version Added: Publisher 2013

Syntax

expression .Type

expression A variable that represents a LineFormat object.

Return value

MSOLINEFILLTYPE

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


ShapeRange.Adjustments Property (Publisher)

 Copy code hover
[image]

ShapeRange.Adjustments Property (Publisher)
Send feedback

Returns an Adjustments collection representing all adjustment handles for the specified Shape or ShapeRange object.

Syntax

expression .Adjustments

expression A variable that represents a ShapeRange object.

Remarks

Adjustment handles correspond to Microsoft Publisher shape sliders.

Example

This example takes the number of adjustments for a given shape range and assigns it to a variable.

Copy code Copy code
Public Sub Counter()

 Dim intCount as Integer

 ' A Shape must be in the active publication and selected.
 intCount = Publisher.ActiveDocument.Selection _
 .ShapeRange(1).Adjustments.Count

End Sub


PictureFormat.OriginalIsTrueColor Property (Publisher)

 Copy code hover
[image]

PictureFormat.OriginalIsTrueColor Property (Publisher)
Send feedback

Returns an MsoTriState constant indicating whether the specified linked picture or OLE object contains color data of 24 bits per channel or greater. Read-only.

Syntax

expression .OriginalIsTrueColor

expression A variable that represents an PictureFormat object.

Return Value

MsoTriState

Remarks

This property only applies to linked pictures or OLE objects. It returns "Permission Denied" for shapes representing embedded or pasted pictures and OLE objects.

To determine whether a shape represents a linked picture, use either the Type property of the Shape object, or the IsLinked property of the PictureFormat object.

The OriginalIsTrueColor property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The specified linked picture does not contain color data of 24 bits per channel or greater.
msoTriStateMixed | Indicates a combination of msoTrue and msoFalse for the specified shape range.
msoTrue | The specified linked picture contains color data of 24 bits per channel or greater.

Example

The following example returns a list of pictures in the active document that are TrueColor. If a picture is linked, and the linked picture is also TrueColor, that information is also returned.

VBA Copy code Copy code
Sub PictureColorInformation()
Dim pgLoop As Page
Dim shpLoop As Shape

For Each pgLoop In ActiveDocument.Pages
 For Each shpLoop In pgLoop.Shapes
 If shpLoop.Type = pbLinkedPicture Or shpLoop.Type = pbPicture Then

 With shpLoop.PictureFormat
 If .IsEmpty = msoFalse Then

 If .IsTrueColor = msoTrue Then
 Debug.Print .Filename
 Debug.Print "This picture is TrueColor"
 If .IsLinked = msoTrue Then
 If .OriginalIsTrueColor = msoTrue Then
 Debug.Print "The linked picture is also TrueColor."
 End If
 End If
 End If

 End If
 End With

 End If
 Next shpLoop
Next pgLoop

End Sub


LineFormat.Weight Property (Publisher)

 Copy code hover
[image]

LineFormat.Weight Property (Publisher)
Send feedback

Returns or sets a Variant indicating the thickness of the specified line or cell border.

Syntax

expression .Weight

expression A variable that represents a LineFormat object.

Remarks

Return values are in points. When setting the property, numeric values are evaluated in points, and strings can be in any units supported by Publisher (for example, "2.5 in").

Example

This example adds a green dashed line, two points thick, to the active publication.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes _
 .AddLine(BeginX:=10, BeginY:=10, _
 EndX:=250, EndY:=250).Line
 .DashStyle = msoLineDashDotDot
 .ForeColor.RGB = RGB(0, 255, 255)
 .Weight = 2
End With


MailMergeMappedDataFields Members (Publisher)

 Copy code hover
[image]

MailMergeMappedDataFields Members (Publisher)
Send feedback

A collection of MailMergeMappedDataField objects that represents the mapped data fields available in Microsoft Publisher.

Methods

Name | Description
Item | Returns an individual object in a specified collection.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


PbPhoneticGuideAlignmentType Enumeration (Publisher)

 Copy code hover
[image]

PbPhoneticGuideAlignmentType Enumeration (Publisher)
Send feedback

Constants passed to the Fields.AddPhoneticGuide method that specify the alignment of the added phonetic text.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbPhoneticGuideAlignmentCenter | 3 | Center aligned
pbPhoneticGuideAlignmentDefault | 0 | Default alignment
pbPhoneticGuideAlignmentLeft | 4 | Left alignment
pbPhoneticGuideAlignmentOneTwoOne | 2 | One Two One alignment
pbPhoneticGuideAlignmentRight | 5 | Right alignment
pbPhoneticGuideAlignmentZeroOneZero | 1 | Zero One Zero alignment


OLEFormat.ObjectVerbs Property (Publisher)

 Copy code hover
[image]

OLEFormat.ObjectVerbs Property (Publisher)
Send feedback

Returns an ObjectVerbs collection that contains all the OLE verbs for the specified OLE object. Read-only.

Syntax

expression .ObjectVerbs

expression A variable that represents an OLEFormat object.

Return Value

ObjectVerbs

Example

This example displays all the available verbs for the OLE object contained in shape one on page two in the active publication. For this example to work, shape one must be a shape that represents an OLE object.

VBA Copy code Copy code
Dim v As String

With ActiveDocument.Pages(2).Shapes(1).OLEFormat
 For Each v In .ObjectVerbs
 MsgBox v
 Next
End With


CalloutFormat.AutoAttach Property (Publisher)

 Copy code hover
[image]

CalloutFormat.AutoAttach Property (Publisher)
Send feedback

Returns or sets an MsoTriState constant indicating whether the place where the callout line attaches to the callout text box changes depending on whether the origin of the callout line (where the callout points) is to the left or right of the callout text box. Read/write.

Syntax

expression .AutoAttach

expression A variable that represents a CalloutFormat object.

Return Value

MsoTriState

Remarks

The AutoAttach property value can be one of the MsoTriState constants declared in the Microsoft Office type library.

When the value of this property is msoTrue, the drop value (the vertical distance from the edge of the callout text box to the place where the callout line attaches) is measured from the top of the text box when the text box is to the right of the origin, and it is measured from the bottom of the text box when the text box is to the left of the origin. When the value of this property is msoFalse, the drop value is always measured from the top of the text box, regardless of the relative positions of the text box and the origin. Use the CustomDrop method to set the drop value, and use the Drop property to return the drop value.

Setting this property affects a callout only if it has an explicitly set drop value—that is, if the value of the DropType property is msoCalloutDropCustom. By default, callouts have explicitly set drop values when they are created.

Example

This example adds two callouts to the first page. One of the callouts is automatically attached and the other is not. If you change the callout line origin for the automatically attached callout to the right of the attached text box, the position of the text box changes. The callout that is not automatically attached does not display this behavior.

Copy code Copy code
With ActivePublication.Pages(1).Shapes
 With .AddCallout(Type:=msoCalloutTwo, _
 Left:=420, Top:=170, Width:=200, Height:=50)
 .TextFrame.TextRange.Text = "auto-attached"
 .Callout.AutoAttach = msoTrue
 End With
 With .AddCallout(Type:=msoCalloutTwo, _
 Left:=420, Top:=350, Width:=200, Height:=50)
 .TextFrame.TextRange.Text = "not auto-attached"
 .Callout.AutoAttach = msoFalse
 End With
End With


MasterPages Methods (Publisher)

 Copy code hover
[image]

MasterPages Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Add | Adds a new Page object to the specified MasterPages object and returns the new Page object.
FindByPageID | Returns a Page object that represents the page with the specified page ID number. Each page is automatically assigned a unique ID number when it is created. Use the PageID property to return a page's ID number.


Font.ThreeD Property (Publisher)

 Copy code hover
[image]

Font.ThreeD Property (Publisher)
See also Send feedback

Returns a ThreeDFormat object that contains 3-D effect formatting properties for the specified font. Read-only.

Version Information

Version Added: Publisher 2013

Syntax

expression .ThreeD

expression A variable that represents a Font object.

Return value

THREEDFORMAT

See also

Concepts

Font Object

Other resources

Font Object Members


MailMerge.Parent Property (Publisher)

 Copy code hover
[image]

MailMerge.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a MailMerge object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


LineFormat.EndArrowheadStyle Property (Publisher)

 Copy code hover
[image]

LineFormat.EndArrowheadStyle Property (Publisher)
Send feedback

Returns or sets an MsoArrowheadStyle constant indicating the style of the arrowhead at the end of the specified line. Read/write.

Syntax

expression .EndArrowheadStyle

expression A variable that represents an LineFormat object.

Return Value

MsoArrowheadStyle

Remarks

Use the BeginArrowheadStyle property to return or set the style of the arrowhead at the beginning of the line.

The EndArrowheadStyle property value can be one of the MsoArrowheadStyle constants declared in the Microsoft Office type library.

Example

This example adds a line to the active publication. There is a short, narrow oval on the line's starting point and a long, wide triangle on its endpoint.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes _
 .AddLine(BeginX:=100, BeginY:=100, _
 EndX:=200, EndY:=300).Line
 .BeginArrowheadLength = msoArrowheadShort
 .BeginArrowheadStyle = msoArrowheadOval
 .BeginArrowheadWidth = msoArrowheadNarrow
 .EndArrowheadLength = msoArrowheadLong
 .EndArrowheadStyle = msoArrowheadTriangle
 .EndArrowheadWidth = msoArrowheadWide
End With


TabStop.Clear Method (Publisher)

 Copy code hover
[image]

TabStop.Clear Method (Publisher)
Send feedback

Removes the specified custom tab stop.

Syntax

expression .Clear

expression A variable that represents a TabStop object.


WebCheckBox Properties (Publisher)

 Copy code hover
[image]

WebCheckBox Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
ReturnDataLabel | Returns or sets a String that represents the text used by the Web page to label the specified Web object when the page is submitted. Read/write.
Selected | Specifies whether a Web check box or option button is selected. Read/write.
Value | Returns or sets a String that represents the value of a Web check box or option button. Read/write.


Shape.MoveToPage Method (Publisher)

 Copy code hover
[image]

Shape.MoveToPage Method (Publisher)
Send feedback

Moves a shape to the specified page.

Version Information

Version Added: Publisher 2007

Syntax

expression .MoveToPage(Page, Left, Top)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Page | Required | Long | Page to which the shape should be moved.
Left | Optional | Variant | Left position of the shape on the page.
Top | Optional | Variant | Top position of the shape on the page.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the MoveToPage method to move the first shape in the Shapes collection on the first page of a publication to the same relative location on the second page of the publication.

This code assumes that the current publication contains at least two pages, and that there is at least one shape on the first page of the publication.

VBA Copy code Copy code
Public Sub MoveToPage_Example()

 Dim pubShape As Publisher.Shape

 Set pubShape = ThisDocument.Pages(1).Shapes(1)

 pubShape.MoveToPage 2

End Sub


ReflectionFormat.Size Property (Publisher)

 Copy code hover
[image]

ReflectionFormat.Size Property (Publisher)
See also Send feedback

Returns or sets the size of the reflection as a percentage of the reflected shape from 0 to 100. Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .Size

expression A variable that represents a ReflectionFormat object.

Return value

Single

See also

Other resources

ReflectionFormat Object Members
ReflectionFormat Object


MailMergeFilterCriterion Object (Publisher)

 Copy code hover
[image]

MailMergeFilterCriterion Object (Publisher)
Send feedback

Represents a filter to be applied to an attached mail merge or catalog merge data source. The MailMergeFilterCriterion object is a member of the MailMergeFilters object.

Example

Each filter is a line in a query string. Use the Column , Comparison , CompareTo , and Conjunction properties to return or set the data source query criterion. The following example changes an existing filter to remove from the mail merge all records that do not have a Region field equal to "WA". This example assumes that a data source is attached to the active publication.

Copy code Copy code
Sub SetQueryCriterion()
 Dim intItem As Integer
 With ActiveDocument.MailMerge.DataSource.Filters
 For intItem = 1 To .Count
 With .Item(intItem)
 If .Column = "Region" Then
 .Comparison = msoFilterComparisonNotEqual
 .CompareTo = "WA"
 If .Conjunction = "Or" Then .Conjunction = "And"
 End If
 End With
 Next
 End With
End Sub

Use the Add method of the MailMergeFilters object to add a new filter criterion to the query. This example adds a new line to the query string and then applies the combined filter to the data source. This example assumes that a data source is attached to the active publication.

Copy code Copy code
Sub FilterDataSource()
 With ActiveDocument.MailMerge.DataSource
 .Filters.Add Column:="Region", _
 Comparison:=msoFilterComparisonIsBlank, _
 Conjunction:=msoFilterConjunctionAnd
 .ApplyFilter
 End With
End Sub


ColorCMYK.Magenta Property (Publisher)

 Copy code hover
[image]

ColorCMYK.Magenta Property (Publisher)
Send feedback

Sets or returns a Long that represents the magenta component of a CMYK color. Value can be any number between 0 and 255. Read/write.

Syntax

expression .Magenta

expression A variable that represents a ColorCMYK object.

Return Value

Long

Example

This example creates two new shapes and then sets the CMYK fill color for one shape and sets the CMYK values of the second shape to the same CMYK values.

Copy code Copy code
Sub ReturnAndSetCMYK()
 Dim lngCyan As Long
 Dim lngMagenta As Long
 Dim lngYellow As Long
 Dim lngBlack As Long
 Dim shpHeart As Shape
 Dim shpStar As Shape

 Set shpHeart = ActiveDocument.Pages(1).Shapes.AddShape _
 (Type:=msoShapeHeart, Left:=100, _
 Top:=100, Width:=100, Height:=100)
 Set shpStar = ActiveDocument.Pages(1).Shapes.AddShape _
 (Type:=msoShape5pointStar, Left:=200, _
 Top:=100, Width:=150, Height:=150)

 With shpHeart.Fill.ForeColor.CMYK
 .SetCMYK Cyan:=10, Magenta:=80, Yellow:=200, Black:=30
 lngCyan = .Cyan
 lngMagenta = .Magenta
 lngYellow = .Yellow
 lngBlack = .Black
 End With

 'Sets new shape to current shapes CMYK colors
 shpStar.Fill.ForeColor.CMYK.SetCMYK _
 Cyan:=lngCyan, Magenta:=lngMagenta, _
 Yellow:=lngYellow, Black:=lngBlack
End Sub


PbCommandButtonType Enumeration (Publisher)

 Copy code hover
[image]

PbCommandButtonType Enumeration (Publisher)
Send feedback

Indicates whether a Web command button will clear or submit form data.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbCommandButtonReset | 2 | Reset or clear the form.
pbCommandButtonSubmit | 1 | Submit the form.


Font.Name Property (Publisher)

 Copy code hover
[image]

Font.Name Property (Publisher)
Send feedback

Indicates the name of the specified font. Read/write.

Syntax

expression .Name

expression An expression that returns a Font object.

Return Value

String

Example

This example formats a text frame on page one as Arial bold.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.Font
 .Name = "Arial"
 .Bold = True
End With


MailMerge.ShowWizardEx Method (Publisher)

 Copy code hover
[image]

MailMerge.ShowWizardEx Method (Publisher)
Send feedback

Displays the specified catalog or mail merge wizard in a document.

Syntax

expression .ShowWizardEx(ShowDocumentStep, ShowTemplateStep, ShowDataStep, ShowWriteStep, ShowPreviewStep, ShowMergeStep,MergeType,iStep)

expression A variable that represents a MailMerge object.

Parameters

Name | Required/Optional | Data Type | Description
ShowDocumentStep | Optional | Boolean | Not used in Microsoft Publisher 2007. In previous versions, True (the default) displayed the "Select a merge type" step. False removed the step.
ShowTemplateStep | Optional | Boolean | This parameter does not apply to Microsoft Publisher.
ShowDataStep | Optional | Boolean | Not used in Microsoft Publisher 2007. In previous versions, True (the default) displayed the "Select data source" step. False removed the step.
ShowWriteStep | Optional | Boolean | Not used in Microsoft Publisher 2007. In previous versions, True (the default) displayed the "Create your publication" step. False removed the step.
ShowPreviewStep | Optional | Boolean | Not used in Microsoft Publisher 2007. In previous versions, True (the default) displayed the "Preview your publication" step. False removed the step.
ShowMergeStep | Optional | Boolean | Not used in Microsoft Publisher 2007. In previous versions, True (the default) displayed the "Complete the merge" step. False removed the step.
MergeType | Optional | PbMergeType | The merge type to use. See Remarks for possible values.
iStep | Optional | Long | The initial step. See Remarks for information about default values.

Remarks

The MergeType parameter can be one of the PbMergeType constants declared in the Microsoft Publisher type library. The default is pbMergeDefault.

Passing pbMergeDefault for MergeType starts a new mail merge; if the publication is already a merge, it leaves the merge type unchanged.

Passing a merge type that is different from the current publication's merge type changes the publication to that new type of merge, but disconnects the data source. Doing so results in the loss of previously inserted fields when the change is to or from a catalog merge type.

Wizard steps correspond to the sequence of merge task panes in the user interface. If no data source is connected, the merge wizard always starts on the first step (the first task pane). If a data source is connected, the wizard starts on Step 2 by default, unless you use the iStep parameter to specify starting with Step 1 or Step 3.

Example

This example checks whether the Mail Merge Wizard is closed, and if it is, displays it.

VBA Copy code Copy code
Public Sub ShowWizardEx_Example()
 With ActiveDocument.MailMerge
 If .WizardState = 0 Then
 .ShowWizardEx
 End If
 End With
End Sub


RulerGuides.Add Method (Publisher)

 Copy code hover
[image]

RulerGuides.Add Method (Publisher)
Send feedback

Adds a new ruler guide to the specified RulerGuides collection.

Syntax

expression .Add(Position, Type)

expression A variable that represents a RulerGuides object.

Parameters

Name | Required/Optional | Data Type | Description
Position | Required | Variant | The position relative to the left edge or top edge of the page where the new ruler guide will be added. Numeric values are evaluated in points; strings are evaluated in the units specified and can be in any measurement unit supported by Microsoft Publisher (for example, "2.5 in").
Type | Required | PbRulerGuideType | The type of ruler guide to add.

Remarks

Type can be one of these PbRulerGuideType constants.

pbRulerGuideTypeHorizontal

pbRulerGuideTypeVertical

Example

The following example adds ruler guides to page one that are 0.5 inches from the left and top edges of the page.

VBA Copy code Copy code
With ActiveDocument.Pages(1).RulerGuides
 .Add Position:="0.5 in", Type:=pbRulerGuideTypeHorizontal
 .Add Position:="0.5 in", Type:=pbRulerGuideTypeVertical
End With


WizardProperty.Parent Property (Publisher)

 Copy code hover
[image]

WizardProperty.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a WizardProperty object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Concepts (Publisher 2013 developer reference)

 Copy code hover
[image]

Concepts (Publisher 2013 developer reference)
Send feedback

This section contains the following overviews about programmability in Publisher:

  • Returning an Object from a Collection

  • Using Events with the Application Object

  • Using Events with the Document Object


BuildingBlocks Object (Publisher)

 Copy code hover
[image]

BuildingBlocks Object (Publisher)
Send feedback

Represents a collection of one or more BuildingBlock objects.


AdvancedPrintOptions.Resolution Property (Publisher)

 Copy code hover
[image]

AdvancedPrintOptions.Resolution Property (Publisher)
See also Send feedback

Returns or sets a String that represents the resolution, in dots per inch (dpi), at which to print the specified publication. Default is dependent on the printer driver, but is usually "(default)". Read/write.

Syntax

expression .Resolution()

expression A variable that represents a AdvancedPrintOptions object.

Return Value

String

Remarks

Valid values for the Resolution property depend on the printer driver being used. Printers have preset resolutions that cannot be customized. Values must be formatted in the following manner, including spacing:

  • "HorizontalDotsPerInch x VerticalDotsPerInch"

HorizontalDotsPerInch and VerticalDotsPerInch are numeric values, separated by one space, a lowercase x, and another space.

For example, to set the resolution of a printer to 600 horizontal dpi by 600 vertical dpi, a valid string would read "600 x 600".

The Resolution property also accepts the string "(default)" to specify the printer's default resolution setting. If the printer driver presents a language other than English, the Resolution property also accepts the string that denotes the default setting in that language.

If the Resolution property is set to the default printer driver setting, using a Get statement returns the English string "(default)", regardless of whether the resolution was set to default using a non-English string.

This property corresponds to the Resolution control on the Separations tab of the Advanced Print Settings dialog box.

Example

The following example sets the resolution of the active publication at 300 dpi by 300 dpi. The example assumes that "300 x 300" is a valid string for the printer driver used.

VBA Copy code Copy code
ActiveDocument.AdvancedPrintOptions.Resolution = "300 x 300"

See also

Concepts

AdvancedPrintOptions Object

Other resources

AdvancedPrintOptions Object Members


PbPersonalInfoSet Enumeration (Publisher)

 Copy code hover
[image]

PbPersonalInfoSet Enumeration (Publisher)
Send feedback

Indicates the current identity set.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbPersonalInfoHome | 4 | Home
pbPersonalInfoOtherOrganization | 3 | Other organization
pbPersonalInfoPrimaryBusiness | 1 | Primary business
pbPersonalInfoSecondaryBusiness | 2 | Secondary business


InstalledPrinters.Item Property (Publisher)

 Copy code hover
[image]

InstalledPrinters.Item Property (Publisher)
Send feedback

Returns the Printer object with the specified name or at the specified index position in the InstalledPrinters collection. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .Item(Index)

expression A variable that represents an InstalledPrinters collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index position of the installed printer.

Return Value

Printer


ShapeRange.IncrementTop Method (Publisher)

 Copy code hover
[image]

ShapeRange.IncrementTop Method (Publisher)
Send feedback

Moves the specified shape or shape range vertically by the specified distance.

Syntax

expression .IncrementTop(Increment)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Variant | The vertical distance to move the shape or shape range. A positive value moves the shape or shape range down; a negative value moves it up. Numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

Return Value

Nothing

Remarks

Use the IncrementLeft method to move shapes or shape ranges horizontally.

Example

This example duplicates the first shape on the active publication, sets the fill for the duplicate, moves it 70 points to the right and 50 points up, and rotates it 30 degrees clockwise.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes(1).Duplicate
 .Fill.PresetTextured PresetTexture:=msoTextureGranite
 .IncrementLeft Increment:=70
 .IncrementTop Increment:=-50
 .IncrementRotation Increment:=30
End With


Column.Parent Property (Publisher)

 Copy code hover
[image]

Column.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a Column object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


RulerGuides Methods (Publisher)

 Copy code hover
[image]

RulerGuides Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Add | Adds a new ruler guide to the specified RulerGuides collection.


Application.ChangeFileOpenDirectory Method (Publisher)

 Copy code hover
[image]

Application.ChangeFileOpenDirectory Method (Publisher)
See also Send feedback

Sets the folder in which Microsoft Publisher searches for documents. The specified folder's contents are listed the next time the Open Publication dialog box (File menu) is displayed.

Syntax

expression .ChangeFileOpenDirectory(Dir)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Dir | Required | String | The directory path.

Remarks

Publisher searches the specified folder for documents until the user changes the folder in the Open Publication dialog box or the current Publisher session ends. Use the PathForPublications property of the Options object to change the default folder for documents in every Publisher session.

Example

This example changes the folder in which Publisher searches for documents. (Note that PathToDirectory must be replaced with a valid file path for this example to work.)

Copy code Copy code
Sub ChangeOpenPath()
 ChangeFileOpenDirectory Dir:="PathToDirectory"
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


ColorCMYK.Application Property (Publisher)

 Copy code hover
[image]

ColorCMYK.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a ColorCMYK object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


PageSizes.Count Property (Publisher)

 Copy code hover
[image]

PageSizes.Count Property (Publisher)
Send feedback

Returns the number of PageSize objects in the PageSizes collection of the active document. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .Count

expression A variable that represents a PageSizes collection.

Return Value

Long


TextRange.Text Property (Publisher)

 Copy code hover
[image]

TextRange.Text Property (Publisher)
Send feedback

Returns or sets a String that represents the text in a text range or WordArt shape. Read/write.

Syntax

expression .Text

expression A variable that represents a TextRange object.

Example

The following example adds a rectangle to the active publication and adds text to it.

VBA Copy code Copy code
Sub AddTextToShape()
 With ActiveDocument.Pages(1).Shapes.AddShape(Type:=msoShapeRectangle, _
 Left:=72, Top:=72, Width:=250, Height:=140)
 .TextFrame.TextRange.Text = "Here is some test text"
 End With
End Sub


Shape.WebCheckBox Property (Publisher)

 Copy code hover
[image]

Shape.WebCheckBox Property (Publisher)
Send feedback

Returns the WebCheckBox object associated with the specified shape.

Syntax

expression .WebCheckBox

expression A variable that represents a Shape object.

Return Value

WebCheckBox

Example

This example creates a new Web check box and specifies that its default state is checked.

VBA Copy code Copy code
Dim shpNew As Shape
Dim wcbTemp As WebCheckBox

Set shpNew = ActiveDocument.Pages(1).Shapes _
 .AddWebControl(Type:=pbWebControlCheckBox, Left:=100, _
 Top:=123, Width:=17, Height:=12)

Set wcbTemp = shpNew.WebCheckBox

wcbTemp.Selected = msoTrue


Font.Ligature Property (Publisher)

 Copy code hover
[image]

Font.Ligature Property (Publisher)
Send feedback

Returns or sets a pbLigaturePresetType constant that represents the state of the Ligature property on the characters in a text range. The Ligature property enables embellishments to the characters, often in the form of bigger and more flamboyant serifs. Read/write.

Version Information

Version Added: Publisher 2010

Syntax

expression .Ligature

expression A variable that represents a Font object.

Return Value

pbLigaturePresetType

Remarks

Note Note

The Ligature property has an effect only for OpenType fonts that contain ligatures.

Ligatures are alternate appearances of sequences of characters; multiple characters are merged into one glyph. For example, when ligatures are turned on for the word Office, the letters ffi are all joined together into one glyph that displays a continuous line from the first f through the dot in the i.


Wizard Methods (Publisher)

 Copy code hover
[image]

Wizard Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
SetId | Specifies the type of the wizard (template) to which to convert the current publication type.


Pages Properties (Publisher)

 Copy code hover
[image]

Pages Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Item | Returns the specified Page object from a Pages or MasterPages collection. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


PhoneticGuide Members (Publisher)

 Copy code hover
[image]

PhoneticGuide Members (Publisher)
Send feedback

Represents base text with supplementary text appearing above it as a guide to pronunciation.

Methods

Name | Description
Clear | Removes the phonetic information from Japanese text.

Properties

Name | Description
Alignment | Returns a PbPhoneticGuideAlignmentType constant that represents the position of phonetic characters above Japanese text. Read-only.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
BaseText | Returns a String that represents the text to which the specified phonetic text applies. Read-only.
FontName | Returns a String that represents the name of the font applied to phonetic information displayed above Japanese text. Read-only.
FontSize | Returns a Variant that represents the font size of phonetic characters. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Raise | Returns a Variant indicating the distance between the top of the base text and the bottom of the guide text. Read-only.
Text | Returns a String that represents the contents of phonetic text. Read-only.


ColorFormat.Transparency Property (Publisher)

 Copy code hover
[image]

ColorFormat.Transparency Property (Publisher)
Send feedback

Gets or sets the degree of transparency of the color represented by the parent ColorFormat object as a value between 0.0 (opaque) and 1.0 (clear). Read/write.

Version Information

Version Added: Publisher 2007

Syntax

expression .Transparency

expression A variable that represents a ColorFormat object.

Return Value

Single


MailMergeFilterCriterion.Application Property (Publisher)

 Copy code hover
[image]

MailMergeFilterCriterion.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a MailMergeFilterCriterion object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


TabStops.Add Method (Publisher)

 Copy code hover
[image]

TabStops.Add Method (Publisher)
Send feedback

Adds a new tab stop to the specified TabStops collection.

Syntax

expression .Add(Position, Alignment, Leader)

expression A variable that represents a TabStops object.

Parameters

Name | Required/Optional | Data Type | Description
Position | Required | Variant | The horizontal position of the new tab stop relative to the left edge of the text frame. Numeric values are evaluated in points; strings are evaluated in the units specified and can be in any measurement unit supported by Microsoft Publisher (for example, "2.5 in").
Alignment | Required | PbTabAlignmentType | The alignment setting for the tab stop.
Leader | Required | PbTabLeaderType | The type of leader for the tab stop.

Remarks

Alignment can be one of these PbTabAlignmentType constants.

pbTabAlignmentCenter

pbTabAlignmentDecimal

pbTabAlignmentLeading

pbTabAlignmentTrailing

Leader can be one of these PbTabLeaderType constants.

pbTabLeaderBullet

pbTabLeaderDashes

pbTabLeaderDot

pbTabLeaderLine

pbTabLeaderNone

Example

The following example adds a new left-aligned tab stop 0.5 inches from the left edge of the specified text frame.

VBA Copy code Copy code
ActiveDocument.Pages(1).Shapes(1).TextFrame _
 .TextRange.ParagraphFormat.Tabs _
 .Add Position:="0.5 in", _
 Alignment:=pbTabAlignmentLeading, _
 Leader:=pbTabLeaderNone


Stories Properties (Publisher)

 Copy code hover
[image]

Stories Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


AdvancedPrintOptions.PrintRegistrationMarks Property (Publisher)

 Copy code hover
[image]

AdvancedPrintOptions.PrintRegistrationMarks Property (Publisher)
See also Send feedback

True to print registration marks for the specified publication. The default is True. Read/write Boolean.

Syntax

expression .PrintRegistrationMarks

expression A variable that represents a AdvancedPrintOptions object.

Return Value

Boolean

Remarks

Returns "Permission Denied" if any print mode other than separations is selected for the specified publication.

This property corresponds to the Registration marks control on the Page Settings tab of the Advanced Print Settings dialog box.

Registration marks are used to align (register) the printing of two or more press plates on a single page.

These printer's marks print outside the publication and can only be printed if the size of the paper being printed to is larger than the publication page size.

Example

The following example sets crop marks and job information to print with the publication. If the publication is printed as separations, the additional types of printer's marks are also set to print. This example assumes that the size of the paper being printed to is larger than the publication page size.

VBA Copy code Copy code
Sub SetPrintersMarksToPrint()
With ActiveDocument.AdvancedPrintOptions
.PrintCropMarks = True
.PrintJobInformation = True
If PrintMode = pbPrintModeSeparations Then
.PrintRegistrationMarks = True
.PrintDensityBars = True
.PrintColorBars = True
End If
End With
End Sub

See also

Concepts

AdvancedPrintOptions Object

Other resources

AdvancedPrintOptions Object Members


Plate.ConvertToProcess Method (Publisher)

 Copy code hover
[image]

Plate.ConvertToProcess Method (Publisher)
Send feedback

Converts the specified plate from spot color to process.

Syntax

expression .ConvertToProcess

expression A variable that represents a Plate object.

Remarks

The ConvertToProcess method is only accessible if the publication's color mode has been set to process and spot color inks. Use the EnterColorMode method of the Document object to specify a publication's color mode.

Returns "Permission Denied" when applied to a spot color plate. When the color mode includes process color, the process color inks (black, magenta, yellow and cyan) are the first four plates in the Plates collection.

When a plate is converted from spot to process color, all colors in the publication based on the ink that the converted plate represents are converted to process colors.

Example

The following example converts the specified spot color plate to process color. The example assumes the publication's color mode has been specified as spot and process color, and that at least six plates have been defined for the publication.

Copy code Copy code
Sub ChangePlateToProcess()

 With ActiveDocument.Plates.Item(6)
 .ConvertToProcess
 End With

End Sub


PbHorizontalPictureLocking Enumeration (Publisher)

 Copy code hover
[image]

PbHorizontalPictureLocking Enumeration (Publisher)
Send feedback

Indicates where newly inserted pictures appear in relation to the specified frame.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbHorizontalLockingLeft | 1 | New pictures are inserted along the left edge of the frame.
pbHorizontalLockingNone | 0 | New pictures are inserted in the middle between the left and right edges of the frame.
pbHorizontalLockingRight | 2 | New pictures are inserted along the right edge of the frame.
pbHorizontalLockingStretch | 3 | New pictures are horizontally stretched to the full width of the frame.


View.Zoom Property (Publisher)

 Copy code hover
[image]

View.Zoom Property (Publisher)
Send feedback

Returns or sets a PbZoom constant or a value between 10 and 400 indicating the zoom setting of the specified view. Read/write.

Syntax

expression .Zoom

expression A variable that represents a View object.

Return Value

PbZoom

Remarks

The Zoom property value can be one of the PbZoom constants declared in the Microsoft Publisher type library and shown in the following table.

Constant | Description
pbZoomFitSelection | Resizes the page view to the size of the current selection.
pbZoomPageWidth | Resizes the page view to the width of the publication.
pbZoomWholePage | Resizes the page view to the size of a whole page.

Example

The following example sets the zoom for the active publication so that the entire page fits on the screen.

VBA Copy code Copy code
ActiveDocument.ActiveView.Zoom = pbZoomWholePage


TextStyle Members (Publisher)

 Copy code hover
[image]

TextStyle Members (Publisher)
Send feedback

Represents a single built-in or user-defined style. The TextStyle object includes style attributes (font, font style, paragraph spacing, and so on) as properties of the TextStyle object. The TextStyle object is a member of the TextStyles collection. The TextStyles collection includes all the styles in the specified document.

Methods

Name | Description
Delete | Deletes the specified object.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
BaseStyle | Returns or sets a String that represents the style upon which the formatting of another style is based. Read/write.
Description | Returns a String that represents the description of the specified style. For example, a typical description for the Normal style might be "(Default) Times New Roman, (Asian) MS Mincho, 10 pt, Main (Black), Kerning 14 pt, Left, Line spacing 1 sp." Read-only.
Font | Sets or returns a Font object that represents character formatting attributes applied to the specified object. Read/write.
Name | Returns a String value indicating the name of the specified object. Read-only.
NextParagraphStyle | Returns or sets a String that represents the paragraph style that follows the specified text style when a user presses ENTER. Read/write.
ParagraphFormat | Returns a ParagraphFormat object representing the paragraph formatting for the specified text range or text style.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


TextRange.Select Method (Publisher)

 Copy code hover
[image]

TextRange.Select Method (Publisher)
Send feedback

Selects the specified object.

Syntax

expression .Select

expression A variable that represents a TextRange object.

Example

This example selects the upper-left cell from a table that has been added to the first page in the active publication.

VBA Copy code Copy code
Dim shpTable As Shape
Dim cllTemp As Cell

With ActiveDocument.Pages(1).Shapes
 Set shpTable = .AddTable(NumRows:=3, NumColumns:=3, _
 Left:=100, Top:=100, Width:=150, Height:=150)
 Set cllTemp = shpTable.Table.Cells.Item(1)
 cllTemp.Select
End With

This example selects the first column from a table that has been added to the first page in the active publication.

VBA Copy code Copy code
Dim shpTable As Shape
Dim crTemp As CellRange

With ActiveDocument.Pages(1).Shapes
 Set shpTable = .AddTable(NumRows:=3, NumColumns:=3, _
 Left:=100, Top:=100, Width:=150, Height:=150)
 Set crTemp = shpTable.Table.Cells(StartRow:=1, _
 StartColumn:=1, EndRow:=3, EndColumn:=1)
 crTemp.Select
End With

This example selects the first five characters in shape one on page one of the active publication.

VBA Copy code Copy code
ActiveDocument.Pages(1).Shapes(1).TextFrame _
 .TextRange.Characters(1, 5).Select


Shapes.AddTextbox Method (Publisher)

 Copy code hover
[image]

Shapes.AddTextbox Method (Publisher)
Send feedback

Adds a new Shape object representing a text box to the specified Shapes collection.

Syntax

expression .AddTextbox(Orientation, Left, Top, Width, Height)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
Orientation | Required | PbTextOrientation | The orientation of the text box.
Left | Required | Variant | The position of the left edge of the shape representing the text box.
Top | Required | Variant | The position of the top edge of the shape representing the text box.
Width | Required | Variant | The width of the shape representing the text box.
Height | Required | Variant | The height of the shape representing the text box.

Return Value

Shape

Remarks

For the Left, Top, Width, and Height parameters numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

The Orientation parameter can be one of the PbTextOrientation constants declared in the Microsoft Publisher type library and shown in the following table.

Constant | Description
pbTextOrientationHorizontal | A horizontal text box for left-to-right languages.
pbTextOrientationRightToLeft | A horizontal text box for right-to-left languages. This value has no effect if a right-to-left language is not selected.
pbTextOrientationVerticalEastAsia | A vertical text box for East Asian languages. If a non-East Asian language is selected, text appears rotated 90 degrees to the right.

Example

The following example adds a new horizontal text box to the first page of the active publication.

VBA Copy code Copy code
Dim shpTextBox As Shape

Set shpTextBox = ActiveDocument.Pages(1).Shapes.AddTextBox _
 (Orientation:=pbTextOrientationHorizontal, _
 Left:=144, Top:=144, _
 Width:=72, Height:=18)


WebNavigationBarSet.ButtonStyle Property (Publisher)

 Copy code hover
[image]

WebNavigationBarSet.ButtonStyle Property (Publisher)
Send feedback

Sets or returns a PbWizardNavBarButtonStyle constant that represents the style of the navigation bar buttons: large, small, or text-only. Read/write.

Syntax

expression .ButtonStyle

expression A variable that represents a WebNavigationBarSet object.

Return Value

PbWizardNavBarButtonStyle

Remarks

The ButtonStyle property value can be one of the PbWizardNavBarButtonStyle constants declared in the Microsoft Publisher type library.

Example

The following example sets the button style to pbnbButtonStyleLarge for the first Web navigation bar set of the active document.

VBA Copy code Copy code
ActiveDocument.WebNavigationBarSets(1).ButtonStyle = pbnbButtonStyleLarge


TextRange.Start Property (Publisher)

 Copy code hover
[image]

TextRange.Start Property (Publisher)
Send feedback

Returns or sets a Long that represents the starting character position of a text range. Read/write.

Syntax

expression .Start

expression A variable that represents a TextRange object.

Return Value

Long

Remarks

If this property is set to a value larger than that of the End property, the End property is set to the same value as that of the Start property.

Example

This example makes the first 15 characters of the selected text range bold. This example assumes that text is selected in the active publication.

VBA Copy code Copy code
Sub SetSelectionRange()
 With Selection
 With .TextRange
 .Start = 0
 .End = 15
 .Font.Bold = msoTrue
 End With
 End With
End Sub


MailMergeFilters.Creator Property (Publisher)

 Copy code hover
[image]

MailMergeFilters.Creator Property (Publisher)
Send feedback

Returns a Long that represents the application in which the specified object was created. For example, if the object was created in Microsoft Publisher, this property returns the hexadecimal number 4D505542, which represents the string "MSPB." This value can also be represented by the constant.

Syntax

expression .Creator

expression A variable that represents a MailMergeFilters object.


ScratchArea Object (Publisher)

 Copy code hover
[image]

ScratchArea Object (Publisher)
Send feedback

Represents the area outside the boundaries of publication pages where layout elements may be stored with no effect on publication output.

Example

Use the ScratchArea property of the Document object to return a scratch area. Use the Shapes property of the ScratchArea object to return the collection of shapes that are currently on a scratch area.

This example assigns the first shape on the scratch area of the active document to a variable.

Copy code Copy code
Dim saPage As ScratchArea
Dim objFirst As Object

saPage = Application.ActiveDocument.ScratchArea
objFirst = saPage.Shapes(1)


Table.Cells Property (Publisher)

 Copy code hover
[image]

Table.Cells Property (Publisher)
Send feedback

Returns a CellRange object that represents a range of cells in a table.

Syntax

expression .Cells(StartRow, StartColumn, EndRow, EndColumn)

expression A variable that represents a Table object.

Parameters

Name | Required/Optional | Data Type | Description
StartRow | Optional | Long | The row in which the starting cell exists. If this argument is omitted, all the table rows are included in the range.
StartColumn | Optional | Long | The column in which the starting cell exists. If this argument is omitted, all the table columns are included in the range.
EndRow | Optional | Long | The row in which the ending cell exists. If this argument is omitted, only the row specified by StartRow is included in the range. If this argument is specified but StartRow is omitted, an error occurs.
EndColumn | Optional | Long | The column in which the ending cell exists. If this argument is omitted, only the column specified by StartColumn is included in the range. If this argument is specified but StartColumn is omitted, an error occurs.

Remarks

If all arguments are omitted, all the cells in the table are included in the range.

Example

This example merges the first two cells in the first two rows of the specified table.

VBA Copy code Copy code
Sub MergeCells()
 ActiveDocument.Pages(1).Shapes(2).Table _
 .Cells(StartRow:=1, StartColumn:=1, _
 EndRow:=2, EndColumn:=2).Merge
End Sub


TextEffectFormat.RotatedChars Property (Publisher)

 Copy code hover
[image]

TextEffectFormat.RotatedChars Property (Publisher)
Send feedback

msoTrue if characters in the specified WordArt are rotated 90 degrees relative to the WordArt's bounding shape. msoFalse if characters in the specified WordArt retain their original orientation relative to the bounding shape. Read/write.

Syntax

expression .RotatedChars

expression A variable that represents a TextEffectFormat object.

Return Value

MsoTriState

Remarks

If the WordArt has horizontal text, setting the RotatedChars property to True rotates the characters 90 degrees counterclockwise. If the WordArt has vertical text, setting the RotatedChars property to False rotates the characters 90 degrees clockwise. Use the ToggleVerticalText method to switch between horizontal and vertical text flow.

The Flip method and Rotation property of the Shape object and the RotatedChars property and ToggleVerticalText method of the TextEffectFormat object all affect the character orientation and direction of text flow in a Shape object that represents WordArt. You may have to experiment to find out how to combine the effects of these properties and methods to get the result you want.

Example

This example adds WordArt that contains the text "Test" to the active publication and rotates the characters 90 degrees counterclockwise.

VBA Copy code Copy code
Sub CreateFormatWordArt()
 With ActiveDocument.Pages(1).Shapes _
 .AddTextEffect(PresetTextEffect:=msoTextEffect1, _
 Text:="Test", FontName:="Arial Black", FontSize:=36, _
 FontBold:=False, FontItalic:=False, Left:=10, Top:=10)
 .TextEffect.RotatedChars = msoTrue
 End With
End Sub


ColorCMYK.Cyan Property (Publisher)

 Copy code hover
[image]

ColorCMYK.Cyan Property (Publisher)
Send feedback

Sets or returns a Long that represents the cyan component of a CMYK color. Value can be any number between 0 and 255. Read/write.

Syntax

expression .Cyan

expression A variable that represents a ColorCMYK object.

Return Value

Long

Example

This example creates two new shapes and then sets the CMYK fill color for one shape and sets the CMYK values of the second shape to the same CMYK values.

Copy code Copy code
Sub ReturnAndSetCMYK()
 Dim lngCyan As Long
 Dim lngMagenta As Long
 Dim lngYellow As Long
 Dim lngBlack As Long
 Dim shpHeart As Shape
 Dim shpStar As Shape

 Set shpHeart = ActiveDocument.Pages(1).Shapes.AddShape _
 (Type:=msoShapeHeart, Left:=100, _
 Top:=100, Width:=100, Height:=100)
 Set shpStar = ActiveDocument.Pages(1).Shapes.AddShape _
 (Type:=msoShape5pointStar, Left:=200, _
 Top:=100, Width:=150, Height:=150)

 With shpHeart.Fill.ForeColor.CMYK
 .SetCMYK 10, 80, 200, 30
 lngCyan = .Cyan
 lngMagenta = .Magenta
 lngYellow = .Yellow
 lngBlack = .Black
 End With

 'Sets new shape to current shape's CMYK colors
 shpStar.Fill.ForeColor.CMYK.SetCMYK _
 Cyan:=lngCyan, Magenta:=lngMagenta, _
 Yellow:=lngYellow, Black:=lngBlack
End Sub


RulerGuide Methods (Publisher)

 Copy code hover
[image]

RulerGuide Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified object.


ColorFormat.Ink Property (Publisher)

 Copy code hover
[image]

ColorFormat.Ink Property (Publisher)
Send feedback

Returns or sets a Long indicating whether the specified color is a spot color, and if so, the spot plate to which it belongs. Valid values are pbInkNone (default; meaning that the color is not a spot color) or a number between 1 and n where n is the number of spot plates. Read/write.

Syntax

expression .Ink

expression A variable that represents an ColorFormat object.

Return Value

Long

Example

The following example specifies that the color of the first text range on page one of the active publication should be assigned to spot plate two.

Copy code Copy code
ActiveDocument.Pages(1).Shapes(1).TextFrame _
 .TextRange.Font.Color.Ink = 2


ThreeDFormat.IncrementRotationY Method (Publisher)

 Copy code hover
[image]

ThreeDFormat.IncrementRotationY Method (Publisher)
Send feedback

Changes the rotation of the specified shape around the y-axis (vertical) by the specified number of degrees.

Syntax

expression .IncrementRotationY(Increment)

expression A variable that represents a ThreeDFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies by how many degrees to rotate the shape around the y-axis. Can be a value from - 90 through 90. A positive value tilts the shape to the left; a negative value tilts it to the right.

Remarks

Use the RotationY property to set the absolute rotation of the shape around the y-axis.

You cannot adjust the rotation around the y-axis of the specified shape past the upper or lower limit for the RotationY property (90 degrees to - 90 degrees). For example, if the RotationY property is initially set to 80 and you specify 40 for the Increment argument, the resulting rotation will be 90 (the upper limit for the RotationY property) instead of 120.

To change the rotation of a shape around the x-axis (horizontal), use the IncrementRotationX method. To change the rotation around the z-axis (extends outward from the plane of the publication), use the IncrementRotation method.

Example

This example tilts the first shape in the active publication 10 degrees to the right. The shape must be an extruded shape for you to see the effect of this code.

Copy code Copy code
ActiveDocument.Pages(1).Shapes(1).ThreeD _
 .IncrementRotationY Increment:=-10


PageSetup Properties (Publisher)

 Copy code hover
[image]

PageSetup Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
AvailablePageSizes | Returns the PageSizes collection that contains all the PageSize objects available in the current publication.
HorizontalGap | Returns a Variant that represents the distance between the right edge of one publication page and left edge of the next publication page in the same row when multiple pages are printed on one sheet of printer paper. Read-only.
LeftMargin | Returns a Variant that represents the distance (in points) between the left edge of the printer sheet and the left edge of the publication pages when multiple pages are printed on a single sheet. Read-only.
PageHeight | Returns or sets a Variant that represents the height of the pages in a publication. Read/write.
PageSize | Gets or sets the blank page size for the current publication. Read/write.
PageWidth | Returns or sets a Variant that represents the width of the pages in a publication. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
PublicationLayout | Returns or sets a PbPublicationLayout Enumeration (Publisher) constant that indicates the layout of a publication. Read/write.
TopMargin | Returns a Variant that represents the distance between the top edge of the printer sheet and the top edge of the publication pages. Read-only.
VerticalGap | Returns a Variant that represents the distance (in points) between the bottom edge of one publication page and top edge of the publication page below it when more than one publication page is printed on a single printer page. Read-only.


TextRange.Lines Method (Publisher)

 Copy code hover
[image]

TextRange.Lines Method (Publisher)
Send feedback

Returns a TextRange object that represents the specified lines.

Syntax

expression .Lines(Start, Length)

expression A variable that represents a TextRange object.

Parameters

Name | Required/Optional | Data Type | Description
Start | Required | Long | The first line in the returned range.
Length | Optional | Long | The number of lines to be returned. Default is 1.

Return Value

TextRange

Remarks

If Start is greater than the number of lines in the specified text, the returned range starts with the last line in the specified range.

If Length is greater than the number of lines from the specified starting line to the end of the text, the returned range contains all those lines.

Example

This example replaces the first three lines of the first shape on the first page with the specified string.

Copy code Copy code
Sub ReplaceLines()
 Dim rngText As TextRange
 Set rngText = ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.Lines(Start:=1, Length:=3)

 rngText.Text = "This is replacement text." & vbCrLf

End Sub


Attachments Object (Publisher)

 Copy code hover
[image]

Attachments Object (Publisher)
See also Send feedback

The collection of Attachment objects that represents all the attachments to a merged e-mail message.

Version Information

Version Added: Publisher 2007

Remarks

The Attachments collection corresponds to the list of attachments in the Attachments box in the Merge to E-mail dialog box in the Microsoft Publisher user interface (on the File menu, point to Send E-mail, click Send E-mail Merge, and then click Options).

To add an Attachment object to the Attachments collection and thereby add an attachment to the list of attachments to the merged e-mail that you want to send, use the Attachments.Add method.

To remove a single attachment from an e-mail merge message, use the Attachment.Delete method of the specific Attachment object that you want to remove from the Attachments collection.

To remove all the attachments to the merged e-mail and thereby empty the Attachments collection, use the Attachments.ClearAll method.

The default property of the Attachments collection is the Item property.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the Add method to add an attachment to an e-mail merge message. The macro adds an Attachment object that represents a bitmap image to the Attachments collection of the active document. It also iterates through the Attachments collection and prints the name of each attachment in the Immediate window.

Before running this macro, place a file named image.bmp in the root of the C drive on your computer, or change the name and path of the file in the macro to specify the one you want to attach.

To send an e-mail merge message, you must connect to a data source, create the e-mail merge, and then send the message. For more information, see the EmailMergeEnvelope object topic.

VBA Copy code Copy code
Public Sub Attachments_Example()

 Dim pubAttachments As Publisher.Attachments
 Dim pubAttachment As Publisher.Attachment
 Dim pubAttachment_Added As Publisher.Attachment
 Dim pubMailMerge As Publisher.MailMerge
 Dim pubEmailMergeEnvelope As Publisher.EmailMergeEnvelope

 Set pubMailMerge = ThisDocument.MailMerge
 Set pubEmailMergeEnvelope = pubMailMerge.EmailMergeEnvelope
 Set pubAttachments = pubEmailMergeEnvelope.Attachemts

 Set pubAttachment_Added = pubAttachments.Add("C:\image.bmp")

 For Each pubAttachment In pubAttachments
 Debug.Print pubAttachment.Name
 Next

End Sub

See also

Other resources

Attachments Object Members


ParagraphFormat.ListNumberSeparator Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.ListNumberSeparator Property (Publisher)
Send feedback

Sets or retrieves a PbListSeparator constant that represents the list separator of the specified paragraphs. Read/write.

Syntax

expression .ListNumberSeparator

expression A variable that represents a ParagraphFormat object.

Return Value

PbListNumberSeparator

Remarks

You must set the ListType property to a numbered list type before you set the ListNumberSeparator property. Returns an "Access Denied" message if the list is not a numbered list.

The ListNumberSeparator property value can be one of these PbListSeparator constants.

pbListSeparatorColon

pbListSeparatorDoubleHyphen

pbListSeparatorDoubleParen

pbListSeparatorDoubleSquare

pbListSeparatorParenthesis

pbListSeparatorPeriod

pbListSeparatorPlain

pbListSeparatorSquare

pbListSeparatorWideComma

Example

This example tests to see if the list type is a numbered list, specifically pbListTypeArabic. If the ListType property is set to pbListTypeArabic the ListNumberSeparator property is set to pbListSeparatorParenthesis. Otherwise, the SetListType method is called and passed pbListTypeArabic as the pbListType parameter and then the ListNumberSeparator property can be set.

VBA Copy code Copy code
Dim objParaForm As ParagraphFormat

Set objParaForm = ActiveDocument.Pages(1).Shapes(1) _
.TextFrame.TextRange.ParagraphFormat

With objParaForm
 If .ListType = pbListTypeArabic Then
 .ListNumberSeparator = pbListSeparatorParenthesis
 Else
 .SetListType pbListTypeArabic
 .ListNumberSeparator = pbListSeparatorParenthesis
 End If
End With


MailMergeFilters Properties (Publisher)

 Copy code hover
[image]

MailMergeFilters Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Creator | Returns a Long that represents the application in which the specified object was created. For example, if the object was created in Microsoft Publisher, this property returns the hexadecimal number 4D505542, which represents the string "MSPB." This value can also be represented by the constant.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Page.RulerGuides Property (Publisher)

 Copy code hover
[image]

Page.RulerGuides Property (Publisher)
Send feedback

Returns a RulerGuides collection that represents gridlines used to align objects on a page.

Syntax

expression .RulerGuides

expression A variable that represents a Page object.

Return Value

RulerGuides

Example

This example creates horizontal ruler guides and vertical ruler guides every half inch on the first page of the active publication.

VBA Copy code Copy code
Sub SetRulerGuides()
 Dim intCount As Integer
 Dim intPos As Integer
 With ActiveDocument.Pages(1).RulerGuides
 For intCount = 1 To 16
 intPos = intPos + 36
 .Add Position:=intPos, Type:=pbRulerGuideTypeVertical
 Next intCount
 intPos = 0
 For intCount = 1 To 21
 intPos = intPos + 36
 .Add Position:=intPos, Type:=pbRulerGuideTypeHorizontal
 Next intCount
 End With
End Sub


Font.Swash Property (Publisher)

 Copy code hover
[image]

Font.Swash Property (Publisher)
Send feedback

Returns or sets an MsoTriState constant that represents the state of the Swash property on the characters in a text range. The Swash property enables embellishments to the characters, often in the form of bigger and more flamboyant serifs. Read/write.

Version Information

Version Added: Publisher 2010

Syntax

expression .Swash

expression A variable that represents a Font object.

Return Value

MsoTriState

Remarks

Note Note

The Swash property has an effect only for OpenType fonts that contain swashes.

The Swash property value can be one of the following MsoTriState constants declared in the Microsoft Office type library.

Constant | Description
msoFalse | None of the characters in the range are formatted as swash.
msoTriStateMixed | Return value indicating that the range contains some text formatted as swash and some text not formatted as swash.
msoTriStateToggle | Set value that switches between msoTrue and msoFalse.
msoTrue | All characters in the range are formatted as swash.


ConnectorFormat.Type Property (Publisher)

 Copy code hover
[image]

ConnectorFormat.Type Property (Publisher)
Send feedback

Returns or sets an MsoConnectorType constant that represents the connector type. Read/write.

Syntax

expression .Type

expression A variable that represents a ConnectorFormat object.

Remarks

The Type property value can be one of these MsoConnectorType constants.

msoConnectorCurve

msoConnectorElbow

msoConnectorStraight

msoConnectorTypeMixed


Cell.BorderBottom Property (Publisher)

 Copy code hover
[image]

Cell.BorderBottom Property (Publisher)
Send feedback

Returns a CellBorder object that represents the bottom border for a specified table cell.

Syntax

expression .BorderBottom

expression A variable that represents a Cell object.

Return Value

CellBorder

Example

This example creates a checkerboard design using borders and a fill color with an existing table. This assumes the first shape on page two is a table and not another type of shape and that the table has an uneven number of columns.

Copy code Copy code
Sub FillCellsByRow()
 Dim shpTable As Shape
 Dim rowTable As Row
 Dim celTable As Cell
 Dim intCell As Integer

 intCell = 1

 Set shpTable = ActiveDocument.Pages(2).Shapes(1)
 For Each rowTable In shpTable.Table.Rows
 For Each celTable In rowTable.Cells
 With celTable
 With .BorderBottom
 .Weight = 2
 .Color.RGB = RGB(Red:=0, Green:=0, Blue:=0)
 End With
 With .BorderTop
 .Weight = 2
 .Color.RGB = RGB(Red:=0, Green:=0, Blue:=0)
 End With
 With .BorderLeft
 .Weight = 2
 .Color.RGB = RGB(Red:=0, Green:=0, Blue:=0)
 End With
 With .BorderRight
 .Weight = 2
 .Color.RGB = RGB(Red:=0, Green:=0, Blue:=0)
 End With
 End With
 If intCell Mod 2 = 0 Then
 celTable.Fill.ForeColor.RGB = RGB _
 (Red:=180, Green:=180, Blue:=180)
 Else
 celTable.Fill.ForeColor.RGB = RGB _
 (Red:=255, Green:=255, Blue:=255)
 End If
 intCell = intCell + 1
 Next celTable
 Next rowTable

End Sub


Application.Quit Event (Publisher)

 Copy code hover
[image]

Application.Quit Event (Publisher)
See also Send feedback

Occurs when the user exits Microsoft Publisher.

Syntax

expression .Quit

expression A variable that represents an Application object.

Remarks

For information about using events with the Application object, see Using Events with the Application Object.

See also

Concepts

Application Object

Other resources

Application Object Members


PageSize Object (Publisher)

 Copy code hover
[image]

PageSize Object (Publisher)
Send feedback

Represents the page size of the current Microsoft Publisher publication.

Version Information

Version Added: Publisher 2007

Remarks

The page size represented by the PageSize object corresponds to one of the icons displayed under Blank Page Sizes in the Page Setup dialog box in the Publisher user interface.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the Name property of the PageSize object to get a list of the names of all the page sizes available in the current document and print the list in the Immediate window.

VBA Copy code Copy code
Public Sub PageSizes_Example()

 Dim pubPageSizes As Publisher.PageSizes
 Dim pubPageSize As Publisher.PageSize

 Set pubPageSizes = ThisDocument.PageSetup.AvailablePageSizes
 For Each pubPageSize In pubPageSizes
 Debug.Print pubPageSize.Name
 Next

End Sub


ParagraphFormat.Duplicate Method (Publisher)

 Copy code hover
[image]

ParagraphFormat.Duplicate Method (Publisher)
Send feedback

Creates a duplicate of the specified ParagraphFormat object and then returns the new ParagraphFormat object.

Syntax

expression .Duplicate

expression A variable that represents a ParagraphFormat object.

Return Value

ParagraphFormat

Example

The following example duplicates the paragraph formatting information from the text range in shape one on page one of the active publication and applies it to the text range in shape two.

VBA Copy code Copy code
Dim pfTemp As ParagraphFormat

With ActiveDocument.Pages(1)
 Set pfTemp = .Shapes(1).TextFrame _
 .TextRange.ParagraphFormat.Duplicate
 .Shapes(2).TextFrame _
 .TextRange.ParagraphFormat = pfTemp
End With


Application.WindowDeactivate Event (Publisher)

 Copy code hover
[image]

Application.WindowDeactivate Event (Publisher)
See also Send feedback

Occurs when the application window is deactivated.

Syntax

expression .WindowDeactivate(Wn, )

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Wn | Required | Window | The window that is being deactivated.

Remarks

For information about using events with the Application object, see Using Events with the Application Object.

Example

This example minimizes the window when it is deactivated. This code must be placed in a class module, and an instance of the class must be correctly initialized to see this example work; see Using Events with the Application Object for directions on how to accomplish this.

Copy code Copy code
Public WithEvents appPublisher as Publisher.Application

Private Sub appPublisher_WindowDeactivate _
 (ByVal Wn As Window)
 Wn.WindowState = pbWindowStateMinimize
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


WebCommandButton Object (Publisher)

 Copy code hover
[image]

WebCommandButton Object (Publisher)
Send feedback

Represents a Web command button control. The WebCommandButton object is a member of the Shape object.

Example

Use the AddWebControl method to create new Web command button. Use the WebCommandButton property to access a Web command button control shape. This example creates a Web form Submit command button and sets the script path and file name to run when a user clicks the button.

Copy code Copy code
Sub CreateActionWebButton()
 With ActiveDocument.Pages(1).Shapes.AddWebControl _
 (Type:=pbWebControlCommandButton, Left:=150, _
 Top:=150, Width:=75, Height:=36).WebCommandButton
 .ButtonText = "Submit"
 .ButtonType = pbCommandButtonSubmit
 .ActionURL = "http://www.tailspintoys.com/" _
 & "scripts/ispscript.cgi"
 End With
End Sub


PbReplaceTint Enumeration (Publisher)

 Copy code hover
[image]

PbReplaceTint Enumeration (Publisher)
Send feedback

Constants passed to the Plate.Delete method specifying how to replace the colors in a deleted plate.

Name | Value | Description
pbReplaceTintKeepTints | 1 | Maintain the same tint percentage in the ink represented by the replacement plate as in the deleted plate. For example, replace a 100% tint of yellow with a 100% tint of blue.
pbReplaceTintMaintainLuminosity | 2 | Maintain the same lightness value in the ink represented by the replacement plate as in the deleted plate. For example, replace a 100% tint of yellow with an approximately 10% tint of blue.
pbReplaceTintUseDefault | 0 | Default.


GroupShapes.Parent Property (Publisher)

 Copy code hover
[image]

GroupShapes.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a GroupShapes object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


ThreeDFormat.PresetLightingDirection Property (Publisher)

 Copy code hover
[image]

ThreeDFormat.PresetLightingDirection Property (Publisher)
Send feedback

Returns or sets an MsoPresetLightingDirection constant that represents the position of the light source relative to the extrusion. Read/write.

Syntax

expression .PresetLightingDirection

expression A variable that represents a ThreeDFormat object.

Return Value

MsoPresetLightingDirection

Remarks

The PresetLightingDirection property value can be one of the MsoPresetLightingDirection constants declared in the Microsoft Office type library.

The lighting effects you set will not be apparent if the extrusion has a wireframe surface.

Example

This example sets the extrusion for the first shape on the first page of the active publication to extend toward the top of the shape and that the lighting for the extrusion come from the left. For this example to work, the specified shape must be a 3-D shape.

VBA Copy code Copy code
Sub ExtrusionLighting()
 With ActiveDocument.Pages(1).Shapes(1).ThreeD
 .Visible = True
 .SetExtrusionDirection msoExtrusionTop
 .PresetLightingDirection = msoLightingLeft
 End With
End Sub


MailMerge.CreateShortcut Method (Publisher)

 Copy code hover
[image]

MailMerge.CreateShortcut Method (Publisher)
Send feedback

Creates a shortcut to the file that contains the list of recipients or products for a mail merge publication.

Version Information

Version Added: Publisher 2007

Syntax

expression .CreateShortcut(Filename)

expression A variable that represents a MailMerge object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | Name of the mailing list or product list file for which the shortcut should be created.

Remarks

The CreateShortcut method corresponds to the Save a shortcut to recipient list command in the Mail Merge and E-mail Merge task panes, and the Save a shortcut to product list command in the Catalog Merge task pane in the Microsoft Publisher user interface.

Mailing list recipient files have the .ols extension (for Microsoft Office List Shortcut).

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the CreateShortcut method to create a shortcut to a mail-merge recipient list. Before running this macro, ensure that the active document is connected to a data source. If the active document is not already connected to a data source, you can use the MailMerge.OpenDataSource method to make the connection.

Also, before running the code, replace username in the folder path to the saved file with the name of a valid user on your computer, or replace the folder path and file name with a path and file name of your choice.

Note that the folder path used in this example is typical of folder paths in Microsoft Windows Vista. You must have permission to save files in the folder you designate.

VBA Copy code Copy code
Public Sub CreateShortcut_Example()

 Dim pubMailMerge As Publisher.MailMerge
 Set pubMailMerge = ThisDocument.MailMerge

 pubMailMerge.CreateShortcut ("C:\Users\username\Documents\My Data Sources\MyRecipientList")

End Sub


PictureFormat.HasAlphaChannel Property (Publisher)

 Copy code hover
[image]

PictureFormat.HasAlphaChannel Property (Publisher)
Send feedback

Returns an MsoTriState constant indicating whether the specified picture contains an alpha channel. Read-only.

Syntax

expression .HasAlphaChannel

expression A variable that represents a PictureFormat object.

Return Value

MsoTriState

Remarks

An alpha channel is a special 8-bit channel used by some image processing software to contain additional data, such as masking or transparency information.

The HasAlphaChannel property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The specified picture does not contain an alpha channel.
msoTriStateMixed | Indicates a combination of msoTrue and msoFalse for the specified shape range.
msoTrue | The specified picture contains an alpha channel.

Example

The following example returns whether the first shape on the first page of the active publication contains an alpha channel. If the picture is linked, and the original picture contains an alpha channel, that is also returned. This example assumes the shape is a picture.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes(1).PictureFormat
 If .HasAlphaChannel = msoTrue Then
 Debug.Print .Filename
 Debug.Print "This picture contains an alpha channel."

 If .IsLinked = msoTrue Then
 If .OriginalHasAlphaChannel = msoTrue Then
 Debug.Print "The linked picture " & _
 "also contains an alpha channel."
 End If
 End If
 End If
End With


Application.WizardCatalogVisible Property (Publisher)

 Copy code hover
[image]

Application.WizardCatalogVisible Property (Publisher)
See also Send feedback

Returns or sets a Boolean indicating whether the Wizard Catalog is visible. Read/write.

Syntax

expression .WizardCatalogVisible

expression A variable that represents a Application object.

Return Value

Boolean

Example

The following example stores the current state of the Wizard Catalog so that it can restore it later.

VBA Copy code Copy code
Sub WizardCatalogExample()
 Dim blnWizardCatalog As Boolean

 ' Store current state of Wizard Catalog.
 blnWizardCatalog = Application.WizardCatalogVisible

 ' Code can run here that shows or hides the Wizard
 ' Catalog as necessary; the original setting
 ' will be restored at the end of the procedure.

 ' Restore original state of Wizard Catalog.
 Application.WizardCatalogVisible = blnWizardCatalog
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Documents.Parent Property (Publisher)

 Copy code hover
[image]

Documents.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a Documents object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


HeaderFooter.Application Property (Publisher)

 Copy code hover
[image]

HeaderFooter.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a HeaderFooter object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Hyperlink.Parent Property (Publisher)

 Copy code hover
[image]

Hyperlink.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a Hyperlink object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


ParagraphFormat.KeepLinesTogether Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.KeepLinesTogether Property (Publisher)
Send feedback

Sets or returns an MsoTriState that indicates whether all lines in the specified paragraph will remain in the same text box. Read/write.

Syntax

expression .KeepLinesTogether

expression A variable that represents a ParagraphFormat object.

Return Value

msoTriState

Remarks

This option ensures that there is not a text frame or column break between the lines of the specified paragraph. If the paragraphs are too large for the text frame or column, the first line will start at the top of the next text frame or column.

The default setting for this property is msoFalse.

Example

This example sets the KeepLinesTogether property to msoTrue for the specified ParagraphFormat object.

Copy code Copy code
Dim objParaForm As ParagraphFormat
Set objParaForm = ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.Paragraphs(1).ParagraphFormat
objParaForm.KeepLinesTogether = msoTrue


FindReplace.Forward Property (Publisher)

 Copy code hover
[image]

FindReplace.Forward Property (Publisher)
Send feedback

Sets or retrieves a Boolean representing the direction of the text search. True if the find operation searches forward through the document. False if it searches backward through the document. Read/write.

Syntax

expression .Forward

expression A variable that represents a FindReplace object.

Return Value

Boolean

Remarks

Forward must be set to True when replacing text.

Example

This example replaces all occurrences of the word "This" in the selection with "That" in each open publication.

Copy code Copy code
Dim objDocument As Document
For Each objDocument In Documents
 With objDocument.Find
 .Clear
 .MatchCase = True
 .FindText = "This"
 .ReplaceWithText = "That"
 .ReplaceScope = pbReplaceScopeAll
 .Forward = True
 .Execute
 End With
Next objDocument


Font.Underline Property (Publisher)

 Copy code hover
[image]

Font.Underline Property (Publisher)
Send feedback

Returns or sets an PbUnderlineType constant that indicates the type of underline for the selected characters in the specified font in a text range. Read/write.

Syntax

expression .Underline

expression A variable that represents an Font object.

Return Value

PbUnderlineType

Remarks

The Underline property value can be one of the PbUnderlineType constants declared in the Microsoft Publisher type library.

Example

This example formats the characters of the first story with a dashed and heavy underline.

VBA Copy code Copy code
Sub DashHeavy()

 Application.ActiveDocument.Stories(1).TextRange.Font.Underline = pbUnderlineDashHeavy

End Sub


Adjustments Object (Publisher)

 Copy code hover
[image]

Adjustments Object (Publisher)
See also Send feedback

Contains a collection of adjustment values for the specified AutoShape or WordArt object.

Remarks

Each adjustment value represents one way an adjustment handle can be adjusted. Because some adjustment handles can be adjusted in two ways — for instance, some handles can be adjusted both horizontally and vertically — a shape can have more adjustment values than it has adjustment handles. A shape can have up to eight adjustments.

Use the Adjustments property to return an Adjustments object. Use Adjustments(index), where index is the adjustment value's index number, to return a single adjustment value.

Different shapes have different numbers of adjustment values, different kinds of adjustments change the geometry of a shape in different ways, and different kinds of adjustments have different ranges of valid values.

The following table summarizes the ranges of valid adjustment values for different types of adjustments. In most cases, if you specify a value that's beyond the range of valid values, the closest valid value will be assigned to the adjustment.

Type of adjustment | Valid values
Linear (horizontal or vertical) | Generally the value 0.0 represents the left or top edge of the shape and the value 1.0 represents the right or bottom edge of the shape. Valid values correspond to valid adjustments you can make to the shape manually. For example, if you can only pull an adjustment handle half way across the shape manually, the maximum value for the corresponding adjustment will be 0.5. For shapes such as callouts, where the values 0.0 and 1.0 represent the limits of the rectangle defined by the starting and ending points of the callout line, negative numbers and numbers greater than 1.0 are valid values.
Radial | An adjustment value of 1.0 corresponds to the width of the shape. The maximum value is 0.5, or halfway across the shape.
Angle | Values are expressed in degrees. If you specify a value outside the range - 180 to 180, it will be normalized to be within that range.

Example

The following example adds a right-arrow callout to the active document and sets adjustment values for the callout. Note that although the shape has only three adjustment handles, it has four adjustments. Adjustments three and four both correspond to the handle between the head and neck of the arrow.

Copy code Copy code
Sub AdjustRightArrowCallout()
 With ActiveDocument.Pages(1).Shapes.AddShape( _
 Type:=msoShapeRightArrowCallout, Left:=72, Top:=72, _
 Width:=250, Height:=190).Adjustments
 .Item(1) = 0.75 'Adjusts width of text box
 .Item(2) = -0.5 'Adjusts width of arrowhead
 .Item(3) = 0.8 'Adjusts length of arrowhead
 .Item(4) = -0.75 'Adjusts width of arrow neck
 End With
End Sub

See also

Other resources

Adjustments Object Members


FillFormat.RotateWithObject Property (Publisher)

 Copy code hover
[image]

FillFormat.RotateWithObject Property (Publisher)
See also Send feedback

Returns or sets whether the fill rotates with the specified shape. Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .RotateWithObject

expression A variable that represents a FillFormat object.

Return value

MSOTRISTATE

Remarks

The value returned by the RotateWithObject property can be one of the MsoTriState constants listed in the following table.

Constant | Description
msoFalse | The fill does not rotate with the shape.
msoTrue | The fill rotates with the shape.

The setting of the RotateWithObject property corresponds to the setting of the Rotate with shape box on the Fill pane of the Format Shape dialog box in the Publisher 2013 user interface.

Note Note

The Rotate with shape box appears only if you have either the Gradient fill or Picture or texture fill option buttons selected on the Fill pane of the Format Shape dialog box.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


MailMergeDataSource Object (Publisher)

 Copy code hover
[image]

MailMergeDataSource Object (Publisher)
Send feedback

Represents the data source in a mail merge or catalog merge operation.

Example

Use the DataSource property to return the MailMergeDataSource object. The following example displays the name of the data source associated with the active publication.

Copy code Copy code
Sub ShowDataSourceName()
 If ActiveDocument.MailMerge.DataSource.Name <> "" Then _
 MsgBox ActiveDocument.MailMerge.DataSource.Name
End Sub

The following example tests the open data source associated with the active publication to determine whether the LastName field includes the name Fuller.

Copy code Copy code
Sub FindSelectedRecord()
 With ActiveDocument.MailMerge
 If .DataSource.FindRecord(FindText:="Fuller", _
 Field:="LastName") = True Then
 MsgBox "Data was found"
 End If
 End With
End Sub


ShadowFormat.Application Property (Publisher)

 Copy code hover
[image]

ShadowFormat.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a ShadowFormat object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


PhoneticGuide.Alignment Property (Publisher)

 Copy code hover
[image]

PhoneticGuide.Alignment Property (Publisher)
Send feedback

Returns a PbPhoneticGuideAlignmentType constant that represents the position of phonetic characters above Japanese text. Read-only.

Syntax

expression .Alignment

expression A variable that represents a PhoneticGuide object.

Remarks

The Alignment property value can be one of the PbPhoneticGuideAlignmentType constants declared in the Microsoft Publisher type library.


Section.ContinueNumbersFromPreviousSection Property (Publisher)

 Copy code hover
[image]

Section.ContinueNumbersFromPreviousSection Property (Publisher)
Send feedback

True if the specified section continues the numbering from the prvious section. Read/write Boolean.

Syntax

expression .ContinueNumbersFromPreviousSection

expression A variable that represents a Section object.

Return Value

Boolean

Example

The following example adds three pages to the publication, adds a new section after the first page, and then sets the ContinueNumbersFromPreviousSection to False for the new section.

Copy code Copy code
Dim objSection As Section
ActiveDocument.Pages.Add Count:=3, After:=1
Set objSection = ActiveDocument.Sections.Add(StartPageIndex:=2)
objSection.ContinueNumbersFromPreviousSection = False


MailMergeDataSource.FindRecord Method (Publisher)

 Copy code hover
[image]

MailMergeDataSource.FindRecord Method (Publisher)
Send feedback

Searches the contents of the specified mail merge data source for text in a particular field. Returns a Boolean indicating whether the search text is found; True if the search text is found.

Syntax

expression .FindRecord(FindText, Field)

expression A variable that represents a MailMergeDataSource object.

Parameters

Name | Required/Optional | Data Type | Description
FindText | Required | String | The text to look for.
Field | Optional | String | The name of the field to be searched.

Return Value

Boolean

Example

This example displays a merge publication for the first record in which the FirstName field contains Joe. If the record is found, the record number is stored in a variable.

Copy code Copy code
Sub FindDataSourceRecord()
 Dim dsMain As MailMergeDataSource
 Dim intRecord As Integer

 'Makes the data in the data source records instead of the field codes
 ActiveDocument.MailMerge.ViewMailMergeFieldCodes = False

 Set dsMain = ActiveDocument.MailMerge.DataSource

 If dsMain.FindRecord(FindText:="Joe", _
 Field:="FirstName") = True Then
 intRecord = dsMain.ActiveRecord
 End If

End Sub


TextRange.DropCap Property (Publisher)

 Copy code hover
[image]

TextRange.DropCap Property (Publisher)
Send feedback

Returns a DropCap object that represents a dropped capital letter for the paragraphs in the specified text frame.

Syntax

expression .DropCap

expression A variable that represents a TextRange object.

Return Value

DropCap

Example

This example applies a custom dropped capital that is three lines high and spans the first three characters of each paragraph in the specified text frame.

Copy code Copy code
Sub SetDropCap()
 With ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange
 .DropCap.ApplyCustomDropCap FontName:="Snap ITC", _
 Bold:=True, Size:=3, Span:=3
 With .ParagraphFormat
 .SpaceBefore = 6
 .SpaceAfter = 6
 End With
 End With
End Sub


Cell.MarginBottom Property (Publisher)

 Copy code hover
[image]

Cell.MarginBottom Property (Publisher)
Send feedback

Returns or sets a Variant that represents the amount of space (in points) between the text and the bottom edge of a cell, text frame, or page. Read/write.

Syntax

expression .MarginBottom

expression A variable that represents a Cell object.

Example

This example sets the margins of the active publication to two inches.

Copy code Copy code
Sub SetPageMargins()

 With ActiveDocument.LayoutGuides
 .MarginTop = Application.InchesToPoints(Value:=2)
 .MarginBottom = Application.InchesToPoints(Value:=2)
 .MarginLeft = Application.InchesToPoints(Value:=2)
 .MarginRight = Application.InchesToPoints(Value:=2)
 End With

End Sub


WebCheckBox.ReturnDataLabel Property (Publisher)

 Copy code hover
[image]

WebCheckBox.ReturnDataLabel Property (Publisher)
Send feedback

Returns or sets a String that represents the text used by the Web page to label the specified Web object when the page is submitted. Read/write.

Syntax

expression .ReturnDataLabel

expression A variable that represents a WebCheckBox object.

Example

This example creates a new Web text box and specifies the label for the text in the text box when the page is submitted.

Copy code Copy code
Sub LabelWebTextBoxControl()
 With ActiveDocument.Pages(1).Shapes _
 .AddWebControl(Type:=pbWebControlSingleLineTextBox, _
 Left:=100, Top:=100, Width:=300, Height:=15).WebTextBox
 .DefaultText = "Please enter your name here"
 .Limit = 70
 .RequiredControl = msoTrue
 .ReturnDataLabel = "Full_Name"
 End With
End Sub


Application.HideCatalogUI Event (Publisher)

 Copy code hover
[image]

Application.HideCatalogUI Event (Publisher)
See also Send feedback

Occurs when the catalog of publication wizards is hidden in the Microsoft Publisher user interface.

Version Information

Version Added: Publisher 2007

Syntax

expression .HideCatalogUI

expression An expression that returns a Application object.

Remarks

For more information about using events with the Application object, see Using Events with the Application Object.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to handle the HideCatalogUI event. It displays a message notifying the user that the catalog UI is hidden.

VBA Copy code Copy code
Private Sub pubApplication_HideCatalogUI()
 MsgBox "The Wizard Catalog is hidden."
End Sub

For this event to occur, you must place the following line of code in the General Declarations section of your module.

VBA Copy code Copy code
Private WithEvents pubApplication As Application

Then run the following initialization procedure.

VBA Copy code Copy code
Public Sub Initialize_pubApplication()
 Set pubApplication = Publisher.Application
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WindowActivate Event (Publisher)

 Copy code hover
[image]

Application.WindowActivate Event (Publisher)
See also Send feedback

Occurs when the application window is activated.

Syntax

expression .WindowActivate(Wn, )

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Wn | Required | Window | The window that is being activated.

Remarks

For information about using events with the Application object, see Using Events with the Application Object.

Example

This example maximizes the Microsoft Publisher window when it is activated. This code must be placed in a class module, and an instance of the class must be correctly initialized to see this example work; see Using Events with the Application Object for directions on how to accomplish this.

Copy code Copy code
Public WithEvents appPublisher as Publisher.Application

Private Sub appPublisher_WindowActivate _
 (ByVal Wn As Window)
 Wn.WindowState = pbWindowStateMaximize
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


ConnectorFormat.BeginConnectedShape Property (Publisher)

 Copy code hover
[image]

ConnectorFormat.BeginConnectedShape Property (Publisher)
Send feedback

Returns a Shape object that represents the shape to which the beginning of the specified connector is attached.

Syntax

expression .BeginConnectedShape

expression A variable that represents a ConnectorFormat object.

Return Value

Shape

Remarks

If the beginning of the specified connector isn't attached to a shape, an error occurs.

Use the EndConnectedShape property to return the shape attached to the end of a connector.

Example

This example assumes that the first page in the active publication already contains two shapes attached by a connector named Conn1To2. The code adds a rectangle and a connector to the first page. The beginning of the new connector will be attached to the same connection site as the beginning of the connector named Conn1To2, and the end of the new connector will be attached to connection site one on the new rectangle.

Copy code Copy code
Dim shpNew As Shape
Dim intSite As Integer
Dim shpOld As Shape

With ActiveDocument.Pages(1).Shapes

 ' Add new rectangle.
 Set shpNew = .AddShape(Type:=msoShapeRectangle, _
 Left:=450, Top:=190, Width:=200, Height:=100)

 ' Add new connector.
 .AddConnector(Type:=msoConnectorCurve, _
 BeginX:=0, BeginY:=0, EndX:=10, EndY:=10) _
 .Name = "Conn1To3"

 ' Get connection site number of old shape, and set
 ' reference to old shape.
 With .Item("Conn1To2").ConnectorFormat
 intSite = .BeginConnectionSite
 Set shpOld = .BeginConnectedShape
 End With

 ' Connect new connector to old shape and new rectangle.
 With .Item("Conn1To3").ConnectorFormat
 .BeginConnect ConnectedShape:=shpOld, _
 ConnectionSite:=intSite
 .EndConnect ConnectedShape:=shpNew, _
 ConnectionSite:=1
 End With
End With


Fields.Count Property (Publisher)

 Copy code hover
[image]

Fields.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a Fields object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


FindReplace.MatchAlefHamza Property (Publisher)

 Copy code hover
[image]

FindReplace.MatchAlefHamza Property (Publisher)
Send feedback

Sets or returns a Boolean representing whether or not a search operation will match alefs and hamzas. Read/write.

Syntax

expression .MatchAlefHamza

expression A variable that represents a FindReplace object.

Return Value

Boolean

Remarks

This property may not be available depending on the language enabled on your operating system. The default value is False.

Returns Access denied if Arabic is not enabled.

Example

This example finds the first occurrence of the word "" in an Arabic document matching alefs and hamzas.

Copy code Copy code
Dim objDocument As Document

Set objDocument = ActiveDocument
With objDocument.Find
 .Clear
 .FindText = ""
 .MatchAlefHamza = True
 .Execute
End With

This example follows from the previous one except that alef hamzas will not be matched. Therefore the words "" or "" will both be found because alefs and hamzas will be ignored.

Copy code Copy code
Dim objDocument As Document

Set objDocument = ActiveDocument
With objDocument.Find
 .Clear
 .FindText = ""
 .MatchAlefHamza = False
 .Execute
End With


PbTrackingPresetType Enumeration (Publisher)

 Copy code hover
[image]

PbTrackingPresetType Enumeration (Publisher)
Send feedback

Represents the preset tracking type for characters in the specified font in a text range.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbTrackingCustom | -1 | Custom
pbTrackingLoose | 1 | Loose
pbTrackingMixed | -2 | Mixed
pbTrackingNormal | 2 | Normal
pbTrackingTight | 3 | Tight
pbTrackingVeryLoose | 0 | Very Loose
pbTrackingVeryTight | 4 | Very Tight


WebHiddenFields.Parent Property (Publisher)

 Copy code hover
[image]

WebHiddenFields.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a WebHiddenFields object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Field.Next Property (Publisher)

 Copy code hover
[image]

Field.Next Property (Publisher)
Send feedback

Returns a Field object that represents the next field in a text range.

Syntax

expression .Next

expression A variable that represents a Field object.

Return Value

Field

Example

This example makes the field next to the first field in the specified text range bold. This assumes that there are at least two fields in the specified text range.

Copy code Copy code
Sub GoToNextField()
 ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange _
 .Fields(1).Next.TextRange.Font.Bold = msoTrue
End Sub


Shape.Reflection Property (Publisher)

 Copy code hover
[image]

Shape.Reflection Property (Publisher)
See also Send feedback

Returns a ReflectionFormat object that represents the reflection formatting for a shape. Read-only.

Version Information

Version Added: Publisher 2013

Syntax

expression .Reflection

expression A variable that represents a Shape object.

Return value

REFLECTIONFORMAT

See also

Other resources

Shape Object
Shape Object Members


Shape.Table Property (Publisher)

 Copy code hover
[image]

Shape.Table Property (Publisher)
Send feedback

Returns a Table object that represents a table in Microsoft Publisher.

Syntax

expression .Table

expression A variable that represents a Shape object.

Example

The following example adds a 5x5 table on the first page of the active publication, and then selects the first column of the new table.

VBA Copy code Copy code
Sub NewTable()
 With ActiveDocument.Pages(1).Shapes.AddTable(NumRows:=5, _
 NumColumns:=5, Left:=72, Top:=300, Width:=400, Height:=100)
 .Table.Columns(3).Cells(3).Fill.ForeColor.RGB = RGB _
 (Red:=255, Green:=0, Blue:=0)
 End With
End Sub

The following example selects the specified table in the active publication. This example assumes that there is at least one shape on the first page of the active publication.

VBA Copy code Copy code
Sub SelectTable()
 With ActiveDocument.Pages(1).Shapes(1)
 If .Type = pbTable Then
 .Table.Rows(3).Cells(3).Fill.ForeColor _
 .RGB = RGB(Red:=150, Green:=150, Blue:=150)
 End If
 End With
End Sub


PageBackground.Create Method (Publisher)

 Copy code hover
[image]

PageBackground.Create Method (Publisher)
Send feedback

Creates a new PageBackground object for the specified Page object.

Syntax

expression .Create

expression A variable that represents a PageBackground object.

Remarks

Use PageBackground.Exists to test if a page already has a background before trying to create a new one. Returns a "Permission denied' error if a background already exists.

Example

The following example tests for the existence of a background on the first page of the active document. If a background does not exist then one is created.

Copy code Copy code
If ActiveDocument.Pages(1).Background.Exists = False Then
 ActiveDocument.Pages(1).Background.Create
End If


ShadowFormat.Type Property (Publisher)

 Copy code hover
[image]

ShadowFormat.Type Property (Publisher)
Send feedback

Specifies the shadow type of a shape. Read/write.

Syntax

expression .Type

expression A variable that represents a ShadowFormat object.

Remarks

The Type property value can be one of the MsoShadowType constants declared in the Microsoft Office type library.


Office 2013 documentation copyright notice

 Copy code hover
[image]

Office 2013 documentation copyright notice
Send feedback

Published: July 16, 2012

This document is provided "as-is". Information and views expressed in this document, including URL and other Internet Web site references, may change without notice. You bear the risk of using it.

Some examples depicted herein are provided for illustration only and are fictitious. No real association or connection is intended or should be inferred.

This document does not provide you with any legal rights to any intellectual property in any Microsoft product. You may copy and use this document for your internal, reference purposes.

© 2013 Microsoft Corporation. All rights reserved.

Microsoft, Access, ActiveX, ClearType, Excel, FrontPage, InfoPath, IntelliSense, JScript, MSDN, MS-DOS, MSN, OneNote, Outlook, PowerPoint, SharePoint, Silverlight, SmartArt, SQL Server, Visio, Visual Basic, Visual C#, Visual C++, Visual Studio, Win32, Windows, Windows PowerShell, Windows Server, and Windows Vista are trademarks of the Microsoft group of companies.

All other trademarks are property of their respective owners.


PbDateTimeFormat Enumeration (Publisher)

 Copy code hover
[image]

PbDateTimeFormat Enumeration (Publisher)
Send feedback

A format for the date and time.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbDateEnglish | 8 | English
pbDateISO | 4 | ISO
pbDateLong | 2 | Long
pbDateLongDay | 1 | Long Day
pbDateMon_Yr | 10 | Month or Year
pbDateMonthYr | 9 | Month and Year
pbDateShort | 0 | Short
pbDateShortAbb | 7 | Short Abb
pbDateShortAlt | 3 | Short Alt
pbDateShortMon | 5 | Short Month
pbDateShortSlash | 6 | Short Slash
pbDateTimeEastAsia1 | 17 | East Asia 1
pbDateTimeEastAsia2 | 18 | East Asia 2
pbDateTimeEastAsia3 | 19 | East Asia 3
pbDateTimeEastAsia4 | 20 | East Asia 4
pbDateTimeEastAsia5 | 21 | East Asia 5
pbTime24 | 15 | 24 hours
pbTimeDatePM | 11 | Date/Time in A.M./P.M. format
pbTimeDateSecPM | 12 | Date/Time/Second in A.M./P.M. format
pbTimePM | 13 | Time in A.M./P.M. format
pbTimeSec24 | 16 | Time in 24-hour format
pbTimeSecPM | 14 | Time including seconds in A.M./P.M. format


ShapeRange.GetWidth Method (Publisher)

 Copy code hover
[image]

ShapeRange.GetWidth Method (Publisher)
Send feedback

Returns the width of the shape or shape range as a Single in the specified units. .

Syntax

expression .GetWidth(Unit)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Required | PbUnitType | The units in which to return the width.

Return Value

Single

Remarks

The Unit parameter can be one of the PbUnitType constants declared in the Microsoft Publisher type library.

Use the GetHeight method to return the height of a shape or shape range.

Example

The following example displays the height and width in inches (to the nearest hundredth) of the shape range consisting of all the shapes on the first page of the active publication.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes.Range
 MsgBox "Height of all shapes: " _
 & Format(.GetHeight(Unit:=pbUnitInch), "0.00") _
 & " in" & vbCr _
 & "Width of all shapes: " _
 & Format(.GetWidth(Unit:=pbUnitInch), "0.00") _
 & " in"
End With


PageBackground Methods (Publisher)

 Copy code hover
[image]

PageBackground Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Create | Creates a new PageBackground object for the specified Page object.
Delete | Deletes the specified object.


ColorCMYK Methods (Publisher)

 Copy code hover
[image]

ColorCMYK Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
SetCMYK | Sets a cyan-magenta-yellow-black (CMYK) color value.


Window.Move Method (Publisher)

 Copy code hover
[image]

Window.Move Method (Publisher)
Send feedback

Moves the active document window.

Syntax

expression .Move(Left, Top)

expression A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
Left | Required | Long | The horizontal screen position of the specified window.
Top | Required | Long | The vertical screen position of the specified window.

Remarks

If the application window is either maximized or minimized, this method will return an error.

Example

This example checks the state of the application window, and if it is neither maximized nor minimized, moves the window to the upper left corner of the screen.

VBA Copy code Copy code
Sub MoveWindow()
 With ActiveWindow
 If .WindowState = pbWindowStateNormal Then
 .Move Left:=50, Top:=50
 End If
 End With
End Sub


Tag.Name Property (Publisher)

 Copy code hover
[image]

Tag.Name Property (Publisher)
Send feedback

Returns a String value indicating the name of the specified object. Read-only.

Syntax

expression .Name

expression A variable that represents a Tag object.

Remarks

You can use an object's name in conjunction with the Item method or Item property to return a reference to the object if the Item method or property for the collection that contains the object takes a Variant argument. For example, if the value of the Name property for a shape is Rectangle 2, then .Shapes("Rectangle 2") will return a reference to that shape.

The Name property is the default property for the BorderArt, BorderArtFormat, and Label objects.


Pages Methods (Publisher)

 Copy code hover
[image]

Pages Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Add | Adds a new Page object to the specified Pages object and returns the new Page object.
AddWizardPage | Adds the specified new wizard page to a specified location in a publication.
FindByPageID | Returns a Page object that represents the page with the specified page ID number. Each page is automatically assigned a unique ID number when it is created. Use the PageID property to return a page's ID number.


Plate Methods (Publisher)

 Copy code hover
[image]

Plate Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
ConvertToProcess | Converts the specified plate from spot color to process.
Delete | Deletes the specified plate.


TextRange.Move Method (Publisher)

 Copy code hover
[image]

TextRange.Move Method (Publisher)
Send feedback

Collapses the specified range to its start position or end position and then moves the collapsed object by the specified number of units. This method returns a Long that represents the number of units by which the object was actually moved, or it returns 0 (zero) if the move was unsuccessful.

Syntax

expression .Move(Unit, Size)

expression A variable that represents a TextRange object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Required | PbTextUnit | The unit by which the collapsed range or selection is to be moved.
Size | Required | Long | The number of units by which the specified range or selection is to be moved. If Size is a positive number, the object is collapsed to its end position and moved forward in the document by the specified number of units. If Size is a negative number, the object is collapsed to its start position and moved backward by the specified number of units. You can also control the collapse direction by using the Collapse method before using the Move method.

Return Value

Long

Remarks

The Unit parameter can be one of the PbTextUnit constants declared in the Microsoft Publisher type library and shown in the following table.

pbTextUnitCell

pbTextUnitCharacter

pbTextUnitCharFormat

pbTextUnitCodePoint

pbTextUnitColumn

pbTextUnitLine

pbTextUnitObject

pbTextUnitParaFormat

pbTextUnitParagraph

pbTextUnitRow

pbTextUnitScreen

pbTextUnitSection

pbTextUnitSentence

pbTextUnitStory

pbTextUnitTable

pbTextUnitWindow

pbTextUnitWord

Example

This example collapses the specified range and inserts a new sentence at the beginning of the range.

VBA Copy code Copy code
Sub MoveText()
 Dim rngText As TextRange
 Set rngText = ActiveDocument.Pages(1).Shapes(1).TextFrame _
 .TextRange.Words(Start:=1, Length:=5)
 With rngText
 .Move Unit:=pbTextUnitParagraph, Size:=-1
 .Text = "This adds new text to the beginning of the range. "
 End With
End Sub


RulerGuides.Application Property (Publisher)

 Copy code hover
[image]

RulerGuides.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a RulerGuides object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


MailMergeDataSources.Item Method (Publisher)

 Copy code hover
[image]

MailMergeDataSources.Item Method (Publisher)
Send feedback

Returns the MailMergeDataSource object at the specified index position in the MailMergeDataSources collection.

Version Information

Version Added: Publisher 2007

Syntax

expression .Item(varIndex)

expression A variable that represents a MailMergeDataSources collection.

Parameters

Name | Required/Optional | Data Type | Description
varIndex | Required | Variant | The index number or name of the object to return.

Return Value

MailMergeDataSource

Remarks

The Item method is the default member of the MailMergeDataSources collection

If there is only a single MailMergeDataSource object in the active document, the MailMergeDataSources collection is empty. In that case, if you try to use the DataSources property of the MailMergeDataSource object to get the data sources collection, Microsoft Publisher returns an error.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to get the names of all the connected data sources in the MailMergeDataSources collection in the active document. It uses the IsDataSourceConnected property of the active document to determine if a data source is connected.

If one or more data sources is connected, the macro uses the Count property of the MailMergeDataSources collection to determine how many data sources are connected.

If just one data source is connected, the macro prints the name of that data source in the Immediate window; if more than one data source is connected, the macro uses the Item method of the MailMergeDataSources collection to iterate through the collection and the Name property of the MailMergeDataSource object to print the name of each connected data source in the Immediate window.

VBA Copy code Copy code
Public Sub Item_Example()

 Dim pubMailMergeDataSources As Publisher.MailMergeDataSources
 Dim pubMailMergeDataSource As Publisher.MailMergeDataSource
 Dim lngCount As Long
 Dim intCounter As Integer

 If ThisDocument.IsDataSourceConnected Then

 Set pubMailMergeDataSources = ThisDocument.MailMerge.DataSource.DataSources

 lngCount = pubMailMergeDataSources.Count

 If lngCount > 1 Then

 ' More than one data source is connected.
 For intCounter = 1 To lngCount
 Debug.Print pubMailMergeDataSources.Item(intCounter).Name
 Next

 Else

 ' Only one data source is connected.
 Set pubMailMergeDataSource = ThisDocument.MailMerge.DataSource
 Debug.Print "Only one data source ("; pubMailMergeDataSource.Name; ") is connected."

 End If

 Else

 Debug.Print "No data sources are connected."

 End If

End Sub


InlineShapes.Count Property (Publisher)

 Copy code hover
[image]

InlineShapes.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents an InlineShapes object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


LinkFormat.SourceFullName Property (Publisher)

 Copy code hover
[image]

LinkFormat.SourceFullName Property (Publisher)
Send feedback

Returns a String that represents the path and name of the source file for the specified linked OLE object, picture, or field. Read-only.

Syntax

expression .SourceFullName

expression A variable that represents a LinkFormat object.

Return Value

String

Example

This example displays the path and file name of the source file for all embedded OLE shapes on the first page of the active publication.

VBA Copy code Copy code
Sub DisplaySourceName()
 Dim shp As Shape
 For Each shp In ActiveDocument.Pages(1).Shapes
 If shp.Type = pbEmbeddedOLEObject Then
 With shp.LinkFormat
 MsgBox .SourceFullName
 End With
 End If
 Next
End Sub


MailMergeDataSource.ApplyFilter Method (Publisher)

 Copy code hover
[image]

MailMergeDataSource.ApplyFilter Method (Publisher)
Send feedback

Applies a filter to a mail merge data source to remove (or filter out) specified records containing (or not containing) specific data.

Syntax

expression .ApplyFilter

expression A variable that represents a MailMergeDataSource object.

Example

This example adds a new filter that removes all records with a blank Region field and then applies the filter to the active publication. This example assumes that a mail merge data source is attached to the active publication.

Copy code Copy code
Sub FilterDataSource()
 With ActiveDocument.MailMerge.DataSource
 .Filters.Add Column:="Region", _
 Comparison:=msoFilterComparisonIsBlank, _
 Conjunction:=msoFilterConjunctionAnd
 .ApplyFilter
 End With
End Sub


Options.ResetTips Method (Publisher)

 Copy code hover
[image]

Options.ResetTips Method (Publisher)
Send feedback

Resets tippages so that a user can view them when using features that have been used before.

Syntax

expression .ResetTips

expression A variable that represents an Options object.

Remarks

The ResetTips method is equivalent to clicking Reset Tips on the User Assistance tab of the Options dialog box (Tools menu).

Example

This example resets tip balloons.

Copy code Copy code
Sub ResetTippages()
 Options.ResetTips
End Sub


ShapeRange.Distribute Method (Publisher)

 Copy code hover
[image]

ShapeRange.Distribute Method (Publisher)
Send feedback

Evenly distributes the shapes in the specified shape range.

Syntax

expression .Distribute(DistributeCmd, RelativeTo)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
DistributeCmd | Required | MsoDistributeCmd | Specifies whether shapes are to be distributed horizontally or vertically.
RelativeTo | Required | MsoTriState | Specifies whether to distribute the shapes evenly over the entire horizontal or vertical space on the page or within the horizontal or vertical space that the range of shapes originally occupies.

Remarks

Shapes are distributed so that there is an equal amount of space between one shape and the next. If the shapes are so large that they overlap when distributed over the available space, they are distributed so that there is an equal amount of overlap between one shape and the next.

The DistributeCmd parameter can be one of the following MsoDistributeCmd constants declared in the Microsoft Office type library.

msoDistributeHorizontally

msoDistributeVertically

The RelativeTo parameter can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | Distribute the shapes within the horizontal or vertical space that the range of shapes originally occupies.
msoTrue | Distribute the shapes evenly over the entire horizontal or vertical space on the page.

When RelativeTo is msoTrue, shapes are distributed so that the distance between the two outer shapes and the edges of the page is the same as the distance between one shape and the next. If the shapes must overlap, the two outer shapes are moved to the edges of the page.

When RelativeTo is msoFalse, the two outer shapes are not moved; only the positions of the inner shapes are adjusted.

The z-order of shapes is unaffected by this method.

Example

This example defines a shape range that contains all the AutoShapes on the first page of the active publication and then horizontally distributes the shapes in this range.

VBA Copy code Copy code
' Number of shapes on the page.
Dim intShapes As Integer
' Number of AutoShapes on the page.
Dim intAutoShapes As Integer
' An array of the names of the AutoShapes.
Dim arrAutoShapes() As String
' A looping variable.
Dim shpLoop As Shape
' A placeholder variable for the range containing AutoShapes.
Dim shpRange As ShapeRange

With ActiveDocument.Pages(1).Shapes
 ' Count all the shapes on the page.
 intShapes = .Count

 ' Proceed only if there's at least one shape.
 If intShapes > 1 Then
 intAutoShapes = 0
 ReDim arrAutoShapes(1 To intShapes)

 ' Loop through the shapes on the page and add the names
 ' of any AutoShapes to an array.
 For Each shpLoop In ActiveDocument.Pages(1).Shapes
 If shpLoop.Type = msoAutoShape Then
 intAutoShapes = intAutoShapes + 1
 arrAutoShapes(intAutoShapes) = shpLoop.Name
 End If
 Next shpLoop

 ' Proceed only if there's at least one AutoShape.
 If intAutoShapes > 1 Then
 ReDim Preserve arrAutoShapes(1 To intAutoShapes)

 ' Create a shape range containing all the AutoShapes.
 Set shpRange = .Range(Index:=arrAutoShapes)

 ' Distribute the AutoShapes horizontally
 ' in the space they already occupy.
 shpRange.Distribute _
 DistributeCmd:=msoDistributeHorizontally, RelativeTo:=msoFalse
 End If
 End If
End With


LinkFormat.Update Method (Publisher)

 Copy code hover
[image]

LinkFormat.Update Method (Publisher)
Send feedback

Updates the specified linked OLE object.

Syntax

expression .Update

expression A variable that represents a LinkFormat object.

Example

This example updates all linked OLE objects in the active publication.

Copy code Copy code
Dim pageLoop As Page
Dim shpLoop As Shape

For Each pageLoop In ActiveDocument.Pages
 For Each shpLoop In pageLoop.Shapes

 With shpLoop
 If .Type = pbLinkedOLEObject Then
 .LinkFormat.Update
 End If
 End With

 Next shpLoop
Next pageLoop


MailMerge.WizardState Property (Publisher)

 Copy code hover
[image]

MailMerge.WizardState Property (Publisher)
Send feedback

Returns or sets a Long indicating the current Mail Merge wizard step for a publication. The WizardState property returns a number that equates to the current Mail Merge wizard step; a zero (0) means the Mail Merge wizard is closed. Read/write.

Syntax

expression .WizardState

expression A variable that represents a MailMerge object.

Return Value

Long

Example

This example displays the Mail Merge wizard if it is closed.

VBA Copy code Copy code
Sub ShowMergeWizard()
 With ActiveDocument.MailMerge
 If .WizardState = 0 Then
 .ShowWizard
 End If
 End With
End Sub


EmailMergeEnvelope.Application Property (Publisher)

 Copy code hover
[image]

EmailMergeEnvelope.Application Property (Publisher)
Send feedback

Returns an Application object that represents the creator of the parent EmailMergeEnvelope object. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .Application

expression A variable that represents an EmailMergeEnvelope object.

Return Value

Application


WebListBoxItems.Count Property (Publisher)

 Copy code hover
[image]

WebListBoxItems.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a WebListBoxItems object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


Document.ViewGuides Property (Publisher)

 Copy code hover
[image]

Document.ViewGuides Property (Publisher)
Send feedback

Returns True if guides are visible in the specified publication. Read/write Boolean.

Syntax

expression .ViewGuides

expression A variable that represents a Document object.

Return Value

Boolean


Document.TextStyles Property (Publisher)

 Copy code hover
[image]

Document.TextStyles Property (Publisher)
Send feedback

Returns a TextStyles collection that contains a publication's text styles.

Syntax

expression .TextStyles

expression A variable that represents a Document object.

Return Value

TextStyles

Example

The following example displays the style name and base style of the first style in the TextStyles collection.

VBA Copy code Copy code
Sub BaseStyleName()
 With ActiveDocument.TextStyles(1)
 MsgBox "Style name= " & .Name _
 & vbCr & "Base style= " & .BaseStyle
 End With
End Sub


WebPageOptions.SetBackgroundSoundRepeat Method (Publisher)

 Copy code hover
[image]

WebPageOptions.SetBackgroundSoundRepeat Method (Publisher)
Send feedback

Specifies whether the background sound attached to a Web page should be played infinitely after the page is loaded in a Web browser, and if it should not, optionally specifies the number of times the background sound should be played.

Syntax

expression .SetBackgroundSoundRepeat(RepeatForever, RepeatTimes)

expression A variable that represents a WebPageOptions object.

Parameters

Name | Required/Optional | Data Type | Description
RepeatForever | Required | Boolean | Specifies whether the background sound should be played infinitely. The value of this parameter is used to populate the value of the BackgroundSoundLoopForever Property property.
RepeatTimes | Optional | Long | Specifies how many times the background sound should be played. The value of this parameter is used to populate the value of the BackgroundSoundLoopCount Property property.

Remarks

If the RepeatForever parameter is set to True, the optional RepeatTimes parameter cannot be specified. Attempting to specify RepeatTimes if RepeatForever is True results in a run-time error.

If the RepeatForever parameter is set to False, the optional RepeatTimes parameter must be specified. Omitting RepeatTimes if RepeatForever is False results in a run-time error.

Example

The following example sets the background sound for page four of the active Web publication to a .wav file on the local computer. If BackgroundSoundLoopForever is False, the SetBackgroundSoundRepeat method is used to specify that the background sound be repeated infinitely (note the omission of the RepeatTimes parameter). If BackgroundSoundLoopForever is True, the SetBackgroundSoundRepeat method is used to specify that the background sound not be repeated infinitely, but that it should be repeated twice.

Copy code Copy code
Dim theWPO As WebPageOptions

Set theWPO = ActiveDocument.Pages(4).WebPageOptions

With theWPO
 .BackgroundSound = "C:\CompanySounds\corporate_jingle.wav"
 If .BackgroundSoundLoopForever = False Then
 .SetBackgroundSoundRepeat RepeatForever:=True
 ElseIf .BackgroundSoundLoopForever = True Then
 .SetBackgroundSoundRepeat RepeatForever:=False, RepeatTimes:=2
 End If

End With


CalloutFormat.PresetDrop Method (Publisher)

 Copy code hover
[image]

CalloutFormat.PresetDrop Method (Publisher)
Send feedback

Specifies whether the callout line attaches to the top, bottom, or center of the callout text box or whether it attaches at a point that is a specified distance from the top or bottom of the text box.

Syntax

expression .PresetDrop(DropType)

expression A variable that represents a CalloutFormat object.

Parameters

Name | Required/Optional | Data Type | Description
DropType | Required | MsoCalloutDropType | The starting position of the callout line relative to the text bounding box.

Remarks

The DropType parameter can be one of the MsoCalloutDropType constants declared in the Microsoft Office type library and shown in the following table.

msoCalloutDropBottom

msoCalloutDropCenter

msoCalloutDropCustom

msoCalloutDropTop

Example

This example specifies that the callout line attach to the top of the text bounding box for the first shape in the active publication. For the example to work, the shape must be a callout.

VBA Copy code Copy code
ActiveDocument.Pages(1).Shapes(1).Callout.PresetDrop DropType:=msoCalloutDropTop

This example switches between two preset drops for the first shape one in the active publication. For the example to work, the shape must be a callout.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes(1).Callout
 Select Case .DropType
 Case msoCalloutDropTop
 .PresetDrop DropType:=msoCalloutDropBottom
 Case msoCalloutDropBottom
 .PresetDrop DropType:=msoCalloutDropTop
 End Select
End With


WebListBox Members (Publisher)

 Copy code hover
[image]

WebListBox Members (Publisher)
Send feedback

Represents a Web list box control. The WebListBox object is a member of the Shape object.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
ListBoxItems | Returns a WebListBoxItems object that represents the items in a Web list box control.
MultiSelect | Specifies whether a user may select more than one item in a Web list box control. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
ReturnDataLabel | Returns or sets a String that represents the text used by the Web page to label the specified Web object when the page is submitted. Read/write.


LineFormat.BeginArrowheadWidth Property (Publisher)

 Copy code hover
[image]

LineFormat.BeginArrowheadWidth Property (Publisher)
Send feedback

Returns or sets an MsoArrowheadWidth constant indicating the width of the arrowhead at the beginning of the specified line. Read/write.

Syntax

expression .BeginArrowheadWidth

expression A variable that represents a LineFormat object.

Return Value

MsoArrowheadWidth

Remarks

The BeginArrowheadWidth property value can be one of the MsoArrowheadWidth constants declared in the Microsoft Office type library.

Use the EndArrowheadWidth property to return or set the width of the arrowhead at the end of the line.

Example

This example adds a line to the active publication. There is a short, narrow oval on the line's starting point and a long, wide triangle on its endpoint.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes _
 .AddLine(BeginX:=100, BeginY:=100, _
 EndX:=200, EndY:=300).Line
 .BeginArrowheadLength = msoArrowheadShort
 .BeginArrowheadStyle = msoArrowheadOval
 .BeginArrowheadWidth = msoArrowheadNarrow
 .EndArrowheadLength = msoArrowheadLong
 .EndArrowheadStyle = msoArrowheadTriangle
 .EndArrowheadWidth = msoArrowheadWide
End With


TabStop.Leader Property (Publisher)

 Copy code hover
[image]

TabStop.Leader Property (Publisher)
Send feedback

Sets or returns a PbTabLeaderType constant that represents the leader character for a tab stop. Read/write.

Syntax

expression .Leader

expression A variable that represents a TabStop object.

Return Value

PbTabLeaderType

Remarks

The Leader property value can be one of the PbTabLeaderType constants declared in the Microsoft Publisher type library.

Example

This example changes the leader tab character of the selected paragraphs to dashes. This example assumes that the selected paragraph contains at least one tab stop.

VBA Copy code Copy code
Sub SetLeaderTab()
 Selection.TextRange.ParagraphFormat _
 .Tabs(1).Leader = pbTabLeaderDashes
End Sub

This example changes the leader tab character of the first paragraph in the specified text range to an underline. This example assumes that the specified paragraph contains at least one tab stop.

VBA Copy code Copy code
Sub SetNewTabLeader()
 ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange.Paragraphs(1) _
 .ParagraphFormat.Tabs(1).Leader = pbTabLeaderLine
End Sub


View Object (Publisher)

 Copy code hover
[image]

View Object (Publisher)
Send feedback

Contains the view attributes (show all, field shading, table gridlines, and so on) for a window or pane.

Example

Use the ActiveView property to return the View object. The following example specifies the zoom setting.

Copy code Copy code
Sub ZoomFitSelection()
 ActiveDocument.ActiveView.Zoom = pbZoomFitSelection
End Sub

The following examples zoom in and out, respectively, on the active view.

Copy code Copy code
Sub ViewZoomIn()
 ActiveDocument.ActiveView.ZoomIn
End Sub

Sub ViewZoomOut()
 ActiveDocument.ActiveView.ZoomOut
End Sub

The following example scrolls the active view to the specified shape.

Copy code Copy code
Sub ScrollToShape()
 Dim shpOne As Shape

 Set shpOne = ActiveDocument.Pages(1).Shapes(1)
 ActiveDocument.ActiveView.ScrollShapeIntoView Shape:=shpOne
End Sub


CatalogMergeShapes.Count Property (Publisher)

 Copy code hover
[image]

CatalogMergeShapes.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a CatalogMergeShapes object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


Cell Methods (Publisher)

 Copy code hover
[image]

Cell Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Merge | Merges the specified table cell with another cell. The result is a single table cell.
Select | Selects the specified object.
Split | Splits a merged table cell back into its constituent cells. Returns a CellRange object representing the constituent cells.


Shape.Nodes Property (Publisher)

 Copy code hover
[image]

Shape.Nodes Property (Publisher)
Send feedback

Returns a ShapeNodes collection that represents the geometric description of the specified shape. Applies to Shape or ShapeRange objects that represent freeform drawings.

Syntax

expression .Nodes

expression A variable that represents a Shape object.

Example

This example adds a smooth node with a curved segment after node four in shape three on page one. Shape three must be a freeform drawing with at least four nodes.

Copy code Copy code
With ActiveDocument.Pages(1) _
 .Shapes(3).Nodes
 .Insert Index:=4, SegmentType:=msoSegmentCurve, _
 EditingType:=msoEditingSmooth, X1:=210, Y1:=100
End With


Options.SequenceCheck Property (Publisher)

 Copy code hover
[image]

Options.SequenceCheck Property (Publisher)
Send feedback

True to check the sequence of independent characters for Asian text. Read/write Boolean.

Syntax

expression .SequenceCheck

expression A variable that represents a Options object.

Return Value

Boolean

Example

This example enables sequence checking, allowing the user to input a valid sequence of independent characters to form valid character cells in South Asian text.

VBA Copy code Copy code
Sub CheckSequence()
 Options.SequenceCheck = True
End Sub


Shapes.AddPicture Method (Publisher)

 Copy code hover
[image]

Shapes.AddPicture Method (Publisher)
Send feedback

Adds a new Shape object representing a picture to the specified Shapes collection.

Syntax

expression .AddPicture(Filename, LinkToFile, SaveWithDocument, Left, Top, Width, Height)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | The name of the picture file to insert into the shape. The path can be absolute or relative.
LinkToFile | Required | MsoTriState | Determines whether the picture is linked to or embedded in the publication.
SaveWithDocument | Required | MsoTriState | Determines whether the picture is saved as a separate file with the publication.
Left | Required | Variant | The position of the left edge of the shape representing the picture.
Top | Required | Variant | The position of the top edge of the shape representing the picture.
Width | Optional | Variant | The width of the shape representing the picture. Default is -1, meaning that the width of the shape is automatically set based on the object's data.
Height | Optional | Variant | The height of the shape representing the picture. Default is -1, meaning that the width of the shape is automatically set based on the object's data.

Return Value

Shape

Remarks

If the SaveWithDocument argument is msoTrue, Microsoft Publisher saves a new copy of the picture file specified by the FileName argument in the same directory as the publication.

The LinkToFile and SaveWithDocument arguments cannot have the same value, or else an error occurs. If either argument is msoTrue, the other must be msoFalse.

For the Left, Top, Width, and Height arguments, numeric values are evaluated in points; strings can be in any units supported by Publisher (for example, "2.5 in").

The LinkToFile parameter can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The picture is to be embedded in the publication.
msoTrue | The picture is to be linked to the publication.

Example

The following example adds a picture based on an existing file to the active publication; the picture in the publication is linked to a copy of the original file. (Note that PathToFile must be replaced with a valid file path for this example to work.)

VBA Copy code Copy code
Dim shpPicture As Shape

Set shpPicture = ActiveDocument.Pages(1).Shapes.AddPicture _
 (FileName:="PathToFile", _
 LinkToFile:=msoTrue, _
 SaveWithDocument:=msoTrue
 Left:=72, Top:=72)


PictureFormat.ImageFormat Property (Publisher)

 Copy code hover
[image]

PictureFormat.ImageFormat Property (Publisher)
Send feedback

Returns a PbImageFormat constant that represents the image format of a picture as determined by Microsoft Windows Graphics Device Interface (GDI+). Read-only.

Syntax

expression .ImageFormat

expression A variable that represents an PictureFormat object.

Return Value

PbImageFormat

Remarks

The ImageFormat property applies to the original picture, rather than the placeholder picture, if there is one.

The ImageFormat property value can be one of the PbImageFormat constants declared in the Microsoft Publisher type library.

The ImageFormat property indicates the format of the picture after it has been imported into the Windows environment, rather than its original file format. If the picture's file format is not natively supported by the Windows operating system, the picture is converted to an analogous format that is natively supported. As a result, the pbImageFormatCMYKJPEG, pbImageFormatDIB, pbImageFormatEMF, pbImageFormatGIF, and pbImageFormatPICT constants will rarely, if ever, be returned. Consult the table below for specific file format conversions.

File format | Constant returned
.bmp, .dib, .gif, .pict | pbImageFormatPNG
.emf, .eps, .epfs | pbImageFormatWMF
CMYK .jfif, .jpeg, .jpg | pbImageFormatJPEG

Windows GDI+ is the portion of the Microsoft Windows XP operating system and the Microsoft Windows Server 2003 operating system that provides two-dimensional vector graphics, imaging, and typography.

Example

The following example prints a list of the .jpg and .jpeg images present in the active publication.

VBA Copy code Copy code
Dim pgLoop As Page
Dim shpLoop As Shape

For Each pgLoop In ActiveDocument.Pages
 For Each shpLoop In pgLoop.Shapes

 If shpLoop.Type = pbPicture Or shpLoop.Type = pbLinkedPicture Then

 With shpLoop.PictureFormat
 If .IsEmpty = msoFalse Then

 If .ImageFormat = pbImageFormatJPEG Then
 Debug.Print .Filename
 End If

 End If
 End With

 End If

 Next shpLoop
Next pgLoop


Application.ShowWizardCatalog Method (Publisher)

 Copy code hover
[image]

Application.ShowWizardCatalog Method (Publisher)
See also Send feedback

Displays the Publication Types catalog for the wizard of the specified type.

Version Information

Version Added: Publisher 2007

Syntax

expression .ShowWizardCatalog(Wizard)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Wizard | Optional | PbWizard | The type of wizard catalog to be displayed.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the ShowWizardCatalog method to show the wizard catalog for brochures.

VBA Copy code Copy code
Public Sub ShowWizardCatalog_Example()
 Application.ShowWizardCatalog (pbWizardBrochures)
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


LayoutGuides.Rows Property (Publisher)

 Copy code hover
[image]

LayoutGuides.Rows Property (Publisher)
Send feedback

Sets or returns a Long that represents the number of rows in a layout guide. Read/write.

Syntax

expression .Rows

expression A variable that represents a LayoutGuides object.

Example

This example sets the columns and rows for the layout guides.

VBA Copy code Copy code
Sub SetLayoutGuides()
 With ActiveDocument.LayoutGuides
 .Columns
 .Rows
 End With
End Sub


OLEFormat Methods (Publisher)

 Copy code hover
[image]

OLEFormat Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Activate | Activates a window or OLE object.
DoVerb | Requests that an OLE object perform one of its verbs.


Hyperlinks Object (Publisher)

 Copy code hover
[image]

Hyperlinks Object (Publisher)
Send feedback

Represents the collection of Hyperlink objects in a text range.

Example

Use the Hyperlinks property to return the Hyperlinks collection. The following example deletes all text hyperlinks in the active publication that contain the word "Tailspin" in the address.

Copy code Copy code
Sub DeleteMSHyperlinks()
 Dim pgsPage As Page
 Dim shpShape As Shape
 Dim hprLink As Hyperlink
 For Each pgsPage In ActiveDocument.Pages
 For Each shpShape In pgsPage.Shapes
 If shpShape.HasTextFrame = msoTrue Then
 If shpShape.TextFrame.HasText = msoTrue Then
 For Each hprLink In shpShape.TextFrame.TextRange.Hyperlinks
 If InStr(hprLink.Address, "tailspin") <> 0 Then
 hprLink.Delete
 Exit For
 End If
 Next
 Else
 shpShape.Hyperlink.Delete
 End If
 End If
 Next
 Next
End Sub

Use the Add method to create a hyperlink and add it to the Hyperlinks collection. The following example creates a new hyperlink to the specified Web site.

Copy code Copy code
Sub AddHyperlink()
 Selection.TextRange.Hyperlinks.Add Text:=Selection.TextRange, _
 Address:="http://www.tailspintoys.com/"
End Sub

Use Hyperlinks(index), where index is the index number, to return a single Hyperlink object in a publication, range, or selection. This example displays the address for the first hyperlink if the specified selection contains hyperlinks.

Copy code Copy code
Sub DisplayHyperlinkAddress()
 With Selection.TextRange.Hyperlinks
 If .Count > 0 Then _
 MsgBox .Item(1).Address
 End With
End Sub

The Count property for this collection returns the number of hyperlinks in the specified shape or selection only.


Row.Application Property (Publisher)

 Copy code hover
[image]

Row.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a Row object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Application.PrintPreview Property (Publisher)

 Copy code hover
[image]

Application.PrintPreview Property (Publisher)
See also Send feedback

True to display in Print Preview the publication in the current view. Read/write Boolean.

Syntax

expression .PrintPreview

expression A variable that represents a Application object.

Return Value

Boolean

Example

This example switches the view to Print Preview.

VBA Copy code Copy code
Sub GoToPrintPreview()
 PrintPreview = True
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


LayoutGuides.RowGutterWidth Property (Publisher)

 Copy code hover
[image]

LayoutGuides.RowGutterWidth Property (Publisher)
Send feedback

Returns or sets the width of the row gutters that are used by the LayoutGuides object to aid in the process of laying out design elements. Read/write Single.

Syntax

expression .RowGutterWidth

expression A variable that represents a LayoutGuides object.

Return Value

Single

Remarks

The default width of row gutters is 0.4 inches.

Example

The following example modifies the second master page of the active publication so that it has four rows and four columns, row gutter width of 0.75 inches, column gutter width of 0.5 inches, and center lines in the gutters. Any new pages added to the publication that use the second master page as a template will have these properties.

VBA Copy code Copy code
Dim theMasterPage As page
Dim theLayoutGuides As LayoutGuides

Set theMasterPage = ActiveDocument.MasterPages(2)
Set theLayoutGuides = theMasterPage.LayoutGuides

With theLayoutGuides
 .Rows = 4
 .Columns = 4
 .RowGutterWidth = Application.InchesToPoints(0.75)
 .ColumnGutterWidth = Application.InchesToPoints(0.5)
 .GutterCenterlines = True
End With


Shape Methods (Publisher)

 Copy code hover
[image]

Shape Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
AddToCatalogMergeArea | Adds the specified shape or shapes to the publication page's catalog merge area.
Apply | Applies formatting copied from another shape or shape range using the PickUp method.
Copy | Copies the specified object to the Clipboard.
Cut | Deletes the specified object and places it on the Clipboard.
Delete | Deletes the specified object.
Duplicate | Creates a duplicate of the specified Shape or ShapeRange object, adds the new shape or range of shapes to the Shapes collection immediately after the shape or range of shapes specified originally, and then returns the new Shape or ShapeRange object.
Flip | Flips the specified shape around its horizontal or vertical axis, or flips all the shapes in the specified shape range around their horizontal or vertical axes.
GetHeight | Returns the height of the shape or shape range as a Single in the specified units.
GetLeft | Returns the distance of the shape's or shape range's left edge from the left edge of the leftmost page in the current view as a Single in the specified units.
GetTop | Returns the distance of the shape's or shape range's top edge from the top edge of the leftmost page in the current view as a Single in the specified units.
GetWidth | Returns the width of the shape or shape range as a Single in the specified units.
IncrementLeft | Moves the specified shape or shape range horizontally by the specified distance.
IncrementRotation | Changes the rotation of the specified shape around the z-axis (extends outward from the plane of the publication) by the specified number of degrees.
IncrementTop | Moves the specified shape or shape range vertically by the specified distance.
MoveIntoTextFlow | Moves a given shape into the text flow defined by TextRange Object. The shape will always be inserted inline at the beginning of the text flow.
MoveOutOfTextFlow | Moves a given inline shape out of its containing text range, defined by TextRange Object, and makes the shape fixed.
MoveToPage | Moves a shape to the specified page.
PickUp | Copies formatting from a shape or shape range so that it can be copied to another shape or shape range using the Apply method.
RemoveCatalogMergeArea | Deletes the catalog merge area from the specified publication page. All shapes contained in the catalog merge area remain in place on the page, but are no longer connected to the catalog merge data source.
RemoveFromCatalogMergeArea | Removes a shape from the specified page's catalog merge area. Removed shapes are not deleted, but instead remain in place on the page containing the catalog merge area.
RerouteConnections | Reroutes connectors so that they take the shortest possible path between the shapes they connect. To do this, the RerouteConnections method may detach the ends of a connector and reattach them to different connecting sites on the connected shapes.
SaveAsBuildingBlock | Saves a single shape as a building block. Returns the resulting BuildingBlock object.
SaveAsPicture | Saves a single shape as a picture file.
ScaleHeight | Scales the height of the shape by a specified factor. For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original size or relative to the current size.
ScaleWidth | Scales the width of the shape by a specified factor. For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original size or relative to the current size.
Select | Selects the specified object.
SetCaption |
SetShapesDefaultProperties | Applies the formatting for the specified shape or shape range to the default shape. Shapes created after this method has been used will have this formatting applied to them by default.
Ungroup | Ungroups the specified group of shapes or any groups of shapes in the specified shape range. If the specified shape is a picture or OLE object, Microsoft Publisher will break it apart and convert it to an ungrouped set of shapes. (For example, an embedded Microsoft Office Excel spreadsheet is converted into lines and text boxes.) Returns the ungrouped shapes as a single ShapeRange object.
ZOrder | Moves the specified shape in front of or behind other shapes in the collection (that is, changes the shape's position in the z-order).


WizardValue.Parent Property (Publisher)

 Copy code hover
[image]

WizardValue.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a WizardValue object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


LineFormat.GradientVariant Property (Publisher)

 Copy code hover
[image]

LineFormat.GradientVariant Property (Publisher)
See also Send feedback

Returns the gradient variant for the specified line as an integer value, usually from 1 to 4. Read-only.

Version Information

Version Added: Publisher 2013

Syntax

expression .GradientVariant

expression A variable that represents a LineFormat object.

Return value

Long

Remarks

If the gradient style is msoGradientFromCenter, this property returns either 1 or 2.

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


Application Members (Publisher)

 Copy code hover
[image]

Application Members (Publisher)
Send feedback

Represents the Microsoft Publisher application. The Application object includes properties and methods that return top-level objects. For example, the ActiveDocument property returns a Document object.

Events

Name | Description
AfterPrint | Fires after all variables and fields print.
BeforePrint | Occurs before the publication is printed or previewed. .
DocumentBeforeClose | Occurs immediately before any open document closes.
DocumentOpen | Occurs when opening a document.
HideCatalogUI | Occurs when the catalog of publication wizards is hidden in the Microsoft Publisher user interface.
MailMergeAfterMerge | Occurs after all records in a mail merge have merged successfully.
MailMergeAfterRecordMerge | Occurs after each record in the data source successfully merges in a mail merge.
MailMergeBeforeMerge | Occurs when a merge is executed before any records in a mail merge have merged.
MailMergeBeforeRecordMerge | Occurs as a merge is executed for the individual records in a merge.
MailMergeDataSourceLoad | Occurs when the data source is loaded for a mail merge.
MailMergeDataSourceValidate | Occurs when a user performs address verification by clicking Validate in the Mail Merge Recipients dialog box.
MailMergeGenerateBarcode | Occurs when Microsoft Publisher requires data to generate barcodes in a mail-merge publication, in particular when the mail-merge recipient list changes.
MailMergeInsertBarcode | Occurs when the user issues the command to insert postal barcodes into a mail-merge publication, either in the Microsoft Publisher user interface (UI), or programmatically.
MailMergeRecipientListClose | Fires when the user closes the Mail Merge Recipients dialog box. (From the Mail Merge or E-mail Merge task pane, click Edit Recipient List). Also fires when the user closes the Catalog Merge Product List dialog box, which opens when the user clicks Edit Product List in the Catalog Merge task pane.
MailMergeWizardFollowUpCustom | Fires when the string that appears as the fourth item under Prepare to follow-up on this mailing on the third Mail Merge task pane in the Microsoft Publisher user interface is clicked.
MailMergeWizardStateChange | Occurs when a user changes from a specified step to a specified step in the Mail Merge Wizard.
NewDocument | Occurs when a new publication is created.
Quit | Occurs when the user exits Microsoft Publisher.
ShowCatalogUI | Fires when the catalog of publication wizards is displayed in the Microsoft Publisher user interface.
WindowActivate | Occurs when the application window is activated.
WindowDeactivate | Occurs when the application window is deactivated.
WindowPageChange | Occurs when switching the view from one page to another page in a publication.

Methods

Name | Description
CentimetersToPoints | Converts a measurement from centimeters to points (1 cm = 28.35 points). Returns the converted measurement as a Single.
ChangeFileOpenDirectory | Sets the folder in which Microsoft Publisher searches for documents. The specified folder's contents are listed the next time the Open Publication dialog box (File menu) is displayed.
EmusToPoints | Converts a measurement from emus to points (12700 emus = 1 point). Returns the converted measurement as a Single.
Help | Displays online Help information.
InchesToPoints | Converts a measurement from inches to points (1 inch = 72 points). Returns the converted measurement as a Single.
IsValidObject | Determines whether the specified object variable references a valid object and returns a Boolean value: True if the specified variable that references an object is valid, False if the object referenced by the variable has been deleted.
LinesToPoints | Converts a measurement from lines to points (1 line = 12 points). Returns the converted measurement as a Single.
MillimetersToPoints | Converts a measurement from millimeters to points (1 mm = 2.835 points). Returns the converted measurement as a Single.
NewDocument | Returns a Document object that represents a new publication.
Open | Returns a Document object that represents the newly opened publication.
PicasToPoints | Converts a measurement from picas to points (1 pica = 12 points). Returns the converted measurement as a Single.
PixelsToPoints | Converts a measurement from pixels to points (1 pixel = 0.75 points). Returns the converted measurement as a Single.
PointsToCentimeters | Converts a measurement from points to centimeters (1 cm = 28.35 points). Returns the converted measurement as a Single.
PointsToEmus | Converts a measurement from points to emus (12700 emus = 1 point). Returns the converted measurement as a Single.
PointsToInches | Converts a measurement from points to inches (1 in = 72 points). Returns the converted measurement as a Single.
PointsToLines | Converts a measurement from points to lines (1 line = 12 points). Returns the converted measurement as a Single.
PointsToMillimeters | Converts a measurement from points to millimeters (1 mm = 2.835 points). Returns the converted measurement as a Single.
PointsToPicas | Converts a measurement from points to picas (1 pica = 12 points). Returns the converted measurement as a Single.
PointsToPixels | Converts a measurement from points to pixels (1 pixel = 0.75 points). Returns the converted measurement as a Single.
PointsToTwips | Converts a measurement from points to twips (20 twips = 1 point). Returns the converted measurement as a Single.
Quit | Quits Microsoft Publisher. This is equivalent to clicking Exit on the File menu.
ShowWizardCatalog | Displays the Publication Types catalog for the wizard of the specified type.
TwipsToPoints | Converts a measurement from twips to points (20 twips = 1 point). Returns the converted measurement as a Single.

Properties

Name | Description
ActiveDocument | Returns a Document object that represents the active publication. If there are no documents open, an error occurs.
ActiveWindow | Returns a Window object that represents the window with the focus. Because Microsoft Publisher only has one window, there is only one Window object to return.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Assistance | Gets a reference to the Microsoft Office (MSO) IAssistance object, which provides a means for developers to create a customized Help experience for users within Microsoft Office. Read-only.
AutomationSecurity | Specifies the security mode that Microsoft Publisher uses when programmatically opening files. Read/write.
Build | Returns a Long that represents the Microsoft Publisher build number. Read-only.
CaptionStyles | Returns a CaptionStyles collection that represents all the available caption styles. Read-only.
ColorSchemes | Returns a ColorSchemes collection that represents the color schemes available.
COMAddIns | Returns a COMAddIns collection that represents a reference to the Component Object Model (COM) add-ins currently loaded in Microsoft Publisher.
CommandBars | Sets or returns a CommandBars collection that represents the menu bar and all the toolbars in Microsoft Publisher.
Documents | Returns a Documents collection that represents all open publications. Read-only.
FileDialog | Returns a FileDialog object that represents a single instance of a file dialog box.
InsertBarcodeVisible | Determines whether Add a postal bar code is available under More Items on the Mail Merge and Catalog Merge task panes in the Microsoft Publisher user interface (UI); and whether Add postal bar codes is available under Prepare for Mailing on the Publisher Tasks task pane in the Publisher UI. Read/write.
InstalledPrinters | Returns an InstalledPrinters collection that represents the names of all the printers installed on the computer and to which Microsoft Publisher can print the publication. Read-only.
Language | Returns a Long that represents the language selected for the Microsoft Publisher user interface. Read-only.
Name | Returns a String value indicating the name of the specified object. Read-only.
OfficeDataSourceObject | Returns an OfficeDataSourceObject object representing the data source in a mail merge or catalog merge operation. Read-only.
Options | Returns an Options object that represents application settings you can set in Microsoft Publisher.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Path | Returns a String indicating the full path to the file of the saved active publication, not including the last separator or file name.
PathSeparator | Returns a String that represents the character used to separate folder names. Read-only.
PrintPreview | True to display in Print Preview the publication in the current view. Read/write Boolean.
ProductCode | Returns a String indicating the Microsoft Publisher globally unique identifier (GUID). Read-only.
ScreenUpdating | Returns or sets a Boolean indicating whether Microsoft Publisher refreshes the screen display during run time; True to refresh the screen display. Read/write.
Selection | Returns a Selection object that represents a selected range or the cursor.
ShowFollowUpCustom | Gets or sets the string, if any, that appears as the fourth item under Prepare to follow-up on this mailing on the third Mail Merge task pane in the Microsoft Publisher user interface. Read/write.
SnapToGuides | True for Microsoft Publisher to use the guides to align objects on a page in a publication. Read/write Boolean.
SnapToObjects | True for Microsoft Publisher to use objects on a page to line up other objects. Read/write Boolean.
TemplateFolderPath | Returns a String that represents the location where Microsoft Publisher templates are stored. Read-only.
ValidateAddressVisible | Determines whether Validate addresses is available under Refine recipients in the Mail Merge Recipients dialog box in the Microsoft Publisher user interface (UI); and whether Validate addresses is available under Prepare for Mailing on the Publisher Tasks task pane in the Publisher UI. Read/write.
Version | Returns a String indicating the version number of the currently-installed copy of Microsoft Publisher. Read-only.
WebOptions | Returns a WebOptions object, which represents the properties of Web publications. Read-only.
WizardCatalogVisible | Returns or sets a Boolean indicating whether the Wizard Catalog is visible. Read/write.


PictureFormat Object (Publisher)

 Copy code hover
[image]

PictureFormat Object (Publisher)
Send feedback

Contains properties and methods that apply to pictures.

Example

Use the PictureFormat property to return a PictureFormat object. The following example sets the brightness, contrast, and color transformation for shape one on the active document and crops 18 points off the bottom of the shape. For this example to work, shape one must be either a picture or an OLE object.

Copy code Copy code
Sub FormatPicture()
 With ActiveDocument.Pages(1).Shapes(1).PictureFormat
 .Brightness = 0.6
 .Contrast = 0.7
 .ColorType = msoPictureGrayscale
 .CropBottom = 18
 End With
End Sub


WebPageOptions.Parent Property (Publisher)

 Copy code hover
[image]

WebPageOptions.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a WebPageOptions object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


ParagraphFormat.ListBulletFontName Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.ListBulletFontName Property (Publisher)
Send feedback

Sets or retrieves a String representing the list bullet font name from the specified paragraphs. Read/write.

Syntax

expression .ListBulletFontName

expression A variable that represents a ParagraphFormat object.

Return Value

String

Remarks

Returns an "Access Denied" message if the list is not a bulleted list.

Example

This example tests to see if the list type is a bulleted list. If it is, the ListBulletFontName is set to "Verdana" and the ListFontSize is set to 24.

Copy code Copy code
Dim objParaForm As ParagraphFormat

Set objParaForm = ActiveDocument.Pages(1).Shapes(1) _
.TextFrame.TextRange.ParagraphFormat

With objParaForm
 If .ListType = pbListTypeBullet Then
 .ListBulletFontName = "Verdana"
 .ListBulletFontSize = 24
 End If
End With


Sections Properties (Publisher)

 Copy code hover
[image]

Sections Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Item | Returns an individual object from a specified collection. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


FillFormat.TextureOffsetY Property (Publisher)

 Copy code hover
[image]

FillFormat.TextureOffsetY Property (Publisher)
See also Send feedback

Returns or sets a Long that specifies the vertical offset of the texture from the origin in points. Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .TextureOffsetY

expression A variable that represents a FillFormat object.

Property value

FLOAT

Remarks

The position of the origin is determined by the setting of the TextureAlignment property.

The setting of the TextureOffsetY property corresponds to the setting of the Offset Y box on the Fill pane of the Format Shape dialog box in the Publisher 2013 user interface. (Under Drawing Tools, on the Format tab, click Shape Fill, point to Texture, and then click More Textures.)

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


ShadowFormat.Visible Property (Publisher)

 Copy code hover
[image]

ShadowFormat.Visible Property (Publisher)
Send feedback

Returns or sets an MsoTriState constant indicating whether the specified object or the formatting applied to the specified object is visible. Read/write.

Syntax

expression .Visible

expression A variable that represents a ShadowFormat object.

Remarks

The Visible property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The specified object or formatting is not visible.
msoTriStateMixed | Return value only. The specified shape range contains both objects with visible formatting and objects with invisible formatting.
msoTriStateToggle | Set value only. Switches the specified object between visible and invisble.
msoTrue | The specified object or formatting is visible.

Example

This example sets the horizontal and vertical offsets for the shadow of shape three on the first page in the active publication. The shadow is offset 5 points to the right of the shape and 3 points above it. If the shape does not already have a shadow, this example adds one to it.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes(3).Shadow
 .Visible = msoTrue
 .OffsetX = 5
 .OffsetY = -3
End With


Application.ProductCode Property (Publisher)

 Copy code hover
[image]

Application.ProductCode Property (Publisher)
See also Send feedback

Returns a String indicating the Microsoft Publisher globally unique identifier (GUID). Read-only.

Syntax

expression .ProductCode

expression A variable that represents a Application object.

Return Value

String

Example

The following example displays the product code for Publisher.

VBA Copy code Copy code
MsgBox "The product code for Microsoft Publisher is " _
 & ProductCode

See also

Concepts

Application Object

Other resources

Application Object Members


ColorsInUse.Item Property (Publisher)

 Copy code hover
[image]

ColorsInUse.Item Property (Publisher)
Send feedback

Returns an individual object from a specified collection. Read-only.

Syntax

expression .Item(Index)

expression A variable that represents a ColorsInUse object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The number of the object to return.


DropCap Properties (Publisher)

 Copy code hover
[image]

DropCap Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
FontBold | Sets or returns an MsoTriState constant that represents whether the font for a dropped capital letter or WordArt text effect is bold. Read/write.
FontColor | Returns or sets a ColorFormat object that represents the color applied to a specified dropped capital letter.
FontItalic | Sets or returns an MsoTriState constant that represents whether the font for a dropped capital letter or WordArt text effect is italic. Read/write.
FontName | Sets or returns a String that represents the name of the font applied to a dropped capital letter or WordArt text effect. Read/write.
LinesUp | Returns or sets a Long that represents the number of lines an initial dropped capital letter is raised above the line of text on which it exists. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Size | Returns or sets a Long that represents the number of lines high to format a dropped capital letter. Read/write.
Span | Returns or sets a Long that represents the number of letters included in the specified dropped capital letter. Read/write.


PbTextOrientation Enumeration (Publisher)

 Copy code hover
[image]

PbTextOrientation Enumeration (Publisher)
Send feedback

Represents how text flows in a text box.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbTextOrientationHorizontal | 1 | Horizontal text orientation
pbTextOrientationMixed | -2 | Mixed text orientation
pbTextOrientationRightToLeft | 256 | RightToLeft text orientation
pbTextOrientationVerticalEastAsia | 2 | VerticalEastAsia text orientation


Font.SmallCaps Property (Publisher)

 Copy code hover
[image]

Font.SmallCaps Property (Publisher)
Send feedback

Returns or sets an MsoTriState constant indicating whether the specified text is formatted as small caps. Read/write.

Syntax

expression .SmallCaps

expression A variable that represents a Font object.

Return Value

MsoTriState

Remarks

The SmallCaps property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | None of the characters in the range are formatted as small caps.
msoTriStateMixed | Return value indicating a combination of msoTrue and msoFalse for the specified shape range.
msoTriStateToggle | Set value that switches between msoTrue and msoFalse.
msoTrue | All of the characters in the range are formatted as small caps.

Setting the SmallCaps property to msoTrue removes all caps formatting from the text range.

Example

This example tests the text in the second story and, if it has mixed small caps formatting, it formats all the text as small caps.

VBA Copy code Copy code
Sub SmallCap()

 Dim fntSC As Font

 Set fntSC = Application.ActiveDocument.Stories(2).TextRange.Font
 With fntSC
 If .SmallCaps = msoTriStateMixed Then
 .SmallCaps = msoTrue
 Else
 MsgBox "Mixed small caps are not in this story."
 End If
 End With

End Sub


MailMergeFilters.Add Method (Publisher)

 Copy code hover
[image]

MailMergeFilters.Add Method (Publisher)
Send feedback

Adds a new filter criterion to the specified MailMergeFilters object.

Syntax

expression .Add(Column, Comparison, Conjunction, bstrCompareTo, DeferUpdate)

expression A variable that represents a MailMergeFilters object.

Parameters

Name | Required/Optional | Data Type | Description
Column | Required | String | The name of the table in the data source.
Comparison | Required | MsoFilterComparison | How the data in the table is filtered.
Conjunction | Required | MsoFilterConjunction | How this filter relates to other filters in the MailMergeFilters object.
bstrCompareTo | Optional | String | If the Comparison argument is something other than msoFilterComparisonIsBlank or msoFilterComparisonIsNotBlank, a string to which the data in the table is compared.
DeferUpdate | Optional | Boolean | True to queue the filters and apply them when the ApplyFilter method is called. False to apply the filter condition immediately. Default is False.

Remarks

Comparison can be one of these MsoFilterComparison constants.

msoFilterComparisonContains

msoFilterComparisonEqual

msoFilterComparisonGreaterThan

msoFilterComparisonGreaterThanEqual

msoFilterComparisonIsBlank

msoFilterComparisonIsNotBlank

msoFilterComparisonLessThan

msoFilterComparisonLessThanEqual

msoFilterComparisonNotContains

msoFilterComparisonNotEqual

Conjunction can be one of these MsoFilterConjunction constants.

msoFilterConjunctionAnd

msoFilterConjunctionOr


TextEffectFormat.FontBold Property (Publisher)

 Copy code hover
[image]

TextEffectFormat.FontBold Property (Publisher)
Send feedback

Sets or returns an MsoTriState constant that represents whether the font for a dropped capital letter or WordArt text effect is bold. Read/write.

Syntax

expression .FontBold

expression A variable that represents a TextEffectFormat object.

Remarks

The FontBold property value can be one of the MsoTriState constants declared in the Microsoft Office type library.

Example

This example applies bold formatting to the dropped capital letter in the specified text frame. This example assumes that the specified text frame is formatted with a dropped capital letter.

VBA Copy code Copy code
Sub BoldDropCap()
 With ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.DropCap
 .FontBold = msoTrue
 .FontColor.RGB = RGB(Red:=150, Green:=50, Blue:=180)
 .FontItalic = msoTrue
 .FontName = "Script MT Bold"
 End With
End Sub


MailMergeDataSource.SetAllIncludedFlags Method (Publisher)

 Copy code hover
[image]

MailMergeDataSource.SetAllIncludedFlags Method (Publisher)
Send feedback

True to include all data source records in a mail merge.

Syntax

expression .SetAllIncludedFlags(Included)

expression A variable that represents a MailMergeDataSource object.

Parameters

Name | Required/Optional | Data Type | Description
Included | Required | Boolean | True to include all data source records in a mail merge. False to exclude all data source records from a mail merge.

Remarks

You can set individual records in a data source to be included in or excluded from a mail merge using the Included property.

Example

This example marks all records in the data source as containing an invalid address field, sets a comment as to why it is invalid, and excludes all records from the mail merge.

Copy code Copy code
Sub FlagAllRecords()
 With ActiveDocument.MailMerge.DataSource
 .SetAllErrorFlags Invalid:=True, InvalidComment:= _
 "All records in the data source have only 5-" _
 & "digit ZIP Codes. Need 5+4 digit ZIP Codes."
 .SetAllIncludedFlags Included:=False
 End With
End Sub


ThreeDFormat.SetExtrusionDirection Method (Publisher)

 Copy code hover
[image]

ThreeDFormat.SetExtrusionDirection Method (Publisher)
Send feedback

Sets the direction that the extrusion's sweep path takes away from the extruded shape.

Syntax

expression .SetExtrusionDirection(PresetExtrusionDirection)

expression A variable that represents a ThreeDFormat object.

Parameters

Name | Required/Optional | Data Type | Description
PresetExtrusionDirection | Required | MsoPresetExtrusionDirection | Specifies the extrusion direction.

Remarks

The PresetExtrusionDirection parameter can be one of the MsoPresetExtrusionDirection constants declared in the Microsoft Office type library and shown in the following table.

msoExtrusionBottom

msoExtrusionBottomLeft

msoExtrusionBottomRight

msoExtrusionLeft

msoExtrusionNone

msoExtrusionRight

msoExtrusionTop

msoExtrusionTopLeft

msoExtrusionTopRight

This method sets the PresetExtrusionDirection property to the direction specified by the PresetExtrusionDirection argument.

Example

This example specifies that the extrusion for the first shape in the active publication extend toward the top of the shape and that the lighting for the extrusion come from the left.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes(1).ThreeD
 .Visible = True
 .SetExtrusionDirection _
 PresetExtrusionDirection:=msoExtrusionTop
 .PresetLightingDirection = msoLightingLeft
End With


CellRange.Row Property (Publisher)

 Copy code hover
[image]

CellRange.Row Property (Publisher)
Send feedback

Returns a Long that represents the row number containing the specified cell. Read-only.

Syntax

expression .Row

expression A variable that represents a CellRange object.

Example

This example enters the fill for all even-numbered rows and clears the fill for all odd-numbered rows in the specified table. This example assumes the specified shape is a table and not another type of shape.

VBA Copy code Copy code
Sub FillCellsByRow()
 Dim shpTable As Shape
 Dim rowTable As Row
 Dim celTable As Cell

 Set shpTable = ActiveDocument.Pages(1).Shapes _
 .AddTable(NumRows:=5, NumColumns:=5, Left:=100, _
 Top:=100, Width:=100, Height:=12)
 For Each rowTable In shpTable.Table.Rows
 For Each celTable In rowTable.Cells
 If celTable.Row Mod 2 = 0 Then
 celTable.Fill.ForeColor.RGB = RGB _
 (Red:=180, Green:=180, Blue:=180)
 Else
 celTable.Fill.ForeColor.RGB = RGB _
 (Red:=255, Green:=255, Blue:=255)
 End If
 Next celTable
 Next rowTable

End Sub


Application.MailMergeWizardFollowUpCustom Event (Publisher)

 Copy code hover
[image]

Application.MailMergeWizardFollowUpCustom Event (Publisher)
See also Send feedback

Fires when the string that appears as the fourth item under Prepare to follow-up on this mailing on the third Mail Merge task pane in the Microsoft Publisher user interface is clicked.

Version Information

Version Added: Publisher 2007

Syntax

expression .MailMergeWizardFollowUpCustom(Doc)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The current publication.

Remarks

You can use the ShowFollowUpCustom property to display this string.

For more information about using events with the Application object, see Using Events with the Application Object.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to handle the MailMergeWizardFollowUpCustom event. It displays a message notifying the user that the string described above was displayed.

VBA Copy code Copy code
Private Sub pubApplication_MailMergeWizardFollowUpCustom(ByVal Doc As Document)
 MsgBox "The FollowUpCustom string is clicked."
End Sub

For this event to occur, you must place the following line of code in the General Declarations section of your module.

VBA Copy code Copy code
Private WithEvents pubApplication As Application

Then run the following initialization procedure.

VBA Copy code Copy code
Public Sub Initialize_pubApplication()
 Set pubApplication = Publisher.Application
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Document.PrintStyle Property (Publisher)

 Copy code hover
[image]

Document.PrintStyle Property (Publisher)
Send feedback

Read-only

Version Information

Version Added: Publisher 2010

Syntax

expression .PrintStyle

expression A variable that represents a Document object.


FillFormat.TextureHorizontalScale Property (Publisher)

 Copy code hover
[image]

FillFormat.TextureHorizontalScale Property (Publisher)
See also Send feedback

Returns or sets a Single that specifies the horizontal scaling factor for the texture fill. Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .TextureHorizontalScale

expression A variable that represents a FillFormat object.

Property value

FLOAT

Remarks

The setting of the TextureHorizontalScale property corresponds to the setting of the Scale X box on the Fill pane of the Format Shape dialog box in the Publisher 2013 user interface.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


WebOptionButton Object (Publisher)

 Copy code hover
[image]

WebOptionButton Object (Publisher)
Send feedback

Represents a Web option button control. The WebOptionButton object is a member of the Shape object.

Example

Use the AddWebControl method to create new Web option button. Use the WebOptionButton property to access a Web option button control shape. This example creates a new Web option button and specifies that its default state is selected; then it adds a text box next to it to describe it.

Copy code Copy code
Sub CreateNewWebOptionButton()
 With ActiveDocument.Pages(1).Shapes
 With .AddWebControl(Type:=pbWebControlOptionButton, Left:=100, _
 Top:=123, Width:=16, Height:=10).WebOptionButton
 .Selected = msoTrue
 End With
 With .AddTextbox(Orientation:=pbTextOrientationHorizontal, _
 Left:=120, Top:=120, Width:=70, Height:=15)
 .TextFrame.TextRange.Text = "Advanced User"
 End With
 End With
End Sub


ConnectorFormat.EndConnected Property (Publisher)

 Copy code hover
[image]

ConnectorFormat.EndConnected Property (Publisher)
Send feedback

Returns an MsoTriState constant indicating whether the end of the specified connector is connected to a shape. Read-only.

Syntax

expression .EndConnected

expression A variable that represents an ConnectorFormat object.

Return Value

MsoTriState

Remarks

Use the BeginConnected property to determine if the beginning of a connector is connected to a shape.

The EndConnected property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The end of the specified connector is not connected to a shape.
msoTriStateMixed | Return value only; indicates a combination of msoTrue and msoFalse in the specified shape range.
msoTrue | The end of the specified connector is connected to a shape.

Example

If the third shape on the first page in the active publication is a connector whose end is connected to a shape, this example stores the connection site number, stores a reference to the connected shape, and then disconnects the end of the connector from the shape.

VBA Copy code Copy code
Dim intSite As Integer
Dim shpConnected As Shape

With ActiveDocument.Pages(1).Shapes(3)

 ' Test whether shape is a connector.
 If .Connector Then
 With .ConnectorFormat

 ' Test whether connector is connected to another shape.
 If .End Connected Then

 ' Store connection site number.
 intSite = .EndConnectionSite

 ' Set reference to connected shape.
 Set shpConnected = .EndConnectedShape

 ' Disconnect connector and shape.
 .EndDisconnect
 End If
 End With
 End If
End With


Window Methods (Publisher)

 Copy code hover
[image]

Window Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Activate | Activates a window or OLE object.
Move | Moves the active document window.
Resize | Sizes the Microsoft Publisher application window.


Application Object (Publisher)

 Copy code hover
[image]

Application Object (Publisher)
See also Send feedback

Represents the Microsoft Publisher application. The Application object includes properties and methods that return top-level objects. For example, the ActiveDocument property returns a Document object.

Remarks

When using Microsoft Visual Basic for Applications in Publisher, all of the properties and methods of the Application object can be used without the Application object qualifier. For example, instead of typing Application.ActiveDocument.PrintOut, you can type ActiveDocument.PrintOut. Properties and methods that can be used without the Application object qualifier are considered "global." To view the global properties and methods in the Object Browser, click <globals> at the top of the list in the Classes box. When accessing the Publisher object model from a non-Publisher project, all properties and methods must be fully qualified.

Example

Use the Application property to return the Application object. The following example displays the application name.

Copy code Copy code
Sub ShowAppName()
 MsgBox Application.Name
End Sub

See also

Other resources

Application Object Members


CellBorder.Parent Property (Publisher)

 Copy code hover
[image]

CellBorder.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a CellBorder object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Cell.CellTextOrientation Property (Publisher)

 Copy code hover
[image]

Cell.CellTextOrientation Property (Publisher)
Send feedback

Returns or sets a PbTextOrientation that represents the flow of text in a specified table cell. Read/write.

Syntax

expression .CellTextOrientation

expression A variable that represents a Cell object.

Return Value

PbTextOrientation

Remarks

The CellTextOrientation property value can be one of the PbTextOrientation constants declared in the Microsoft Publisher type library.

Example

This example increases the height of the cells in the first row, and then adds vertically-oriented heading text.

VBA Copy code Copy code
Sub VerticalText()
 Dim rowTable As Row
 Dim celTable As Cell

 With ActiveDocument.Pages(2).Shapes(1).Table.Rows(1)
 .Height = Application.InchesToPoints(1.5)
 For Each celTable In .Cells
 With celTable
 .CellTextOrientation _
 = pbTextOrientationVerticalEastAsia
 .TextRange.ParagraphFormat.Alignment _
 = pbParagraphAlignmentCenter
 .TextRange.Text = "Column Heading " _
 & celTable.Column
 End With
 Next
 End With
End Sub


TextRange.InsertBarcode Method (Publisher)

 Copy code hover
[image]

TextRange.InsertBarcode Method (Publisher)
Send feedback

Inserts a bar code field at the end of the text range represented by the parent TextRange object.

Version Information

Version Added: Publisher 2007

Syntax

expression .InsertBarcode

expression A variable that represents a TextRange object.

Return Value

TextRange

Remarks

Ideally, you should create an add-in to Microsoft Publisher to handle the MailMergeGenerateBarcode and MailMergeInsertBarcode events. If your add-in or code does not contain handlers for these events, the InsertBarcode method returns an error.

The example that follows shows how to handle these events by using Microsoft Visual Basic for Applications (VBA) code in the Visual Basic Editor.

If you want to enable insertion of bar codes into the publication from the user interface, your add-in or VBA code should also set the InsertBarcodeVisible property value to True.

Example

The following example shows how to use the InsertBarcode method to insert a bar-code field into a text box in a publication. Insert this code into your VBA project, and run the AttachToEvents procedure before running the InsertBarcode_Example procedure.

Before running the code in this example, use the MailMerge.OpenDataSource method to connect to a data source. The data source must contain a bar-code column that lists bar codes for all mail-merge recipients, as described in the topic Add postal bar codes to labels or envelopes in Publisher. Replace barcodeColumnIndex in the MailMergeGenerateBarcode event handler in the code with the index number of the data-source column that contains bar-code information.

Run the following code from the Visual Basic Editor window, and not from the Macros dialog box. (On the Tools menu, point to Macro, and then click Macros.)

VBA Copy code Copy code
Public WithEvents pubApplication As Publisher.Application

Private Sub pubApplication_MailMergeGenerateBarcode(ByVal Doc As Document, bstrString As String)

    bstrString = pubApplication.ActiveDocument.MailMerge.DataSource.DataFields.Item(barcodeColumnIndex).Value

End Sub

Private Sub pubApplication_MailMergeInsertBarcode(ByVal Doc As Document, OkToInsert As Boolean)

    OkToInsert = True

End Sub

Public Sub InsertBarcode_Example()

    Dim pubTextRange As Publisher.TextRange
    Dim pubShape As Publisher.Shape

    Set pubShape = ThisDocument.Pages(1).Shapes.AddTextbox(pbTextOrientationHorizontal, 100, 100, 500, 500)
    Set pubTextRange = pubShape.TextFrame.TextRange

    pubTextRange.InsertBarcode

End Sub

Public Sub AttachToEvents()

    Set pubApplication = Application

End Sub


WebCheckBox.Selected Property (Publisher)

 Copy code hover
[image]

WebCheckBox.Selected Property (Publisher)
Send feedback

Specifies whether a Web check box or option button is selected. Read/write.

Syntax

expression .Selected

expression A variable that represents a WebCheckBox object.

Remarks

The Selected property value can be one of the MsoTriState constants declared in the Microsoft Office type library.

Example

This example adds a new Web check box to the first page of the active publication and then selects it.

VBA Copy code Copy code
Sub AddNewWebCheckBox()
 With ActiveDocument.Pages(1).Shapes.AddWebControl _
 (Type:=pbWebControlCheckBox, Left:=100, _
 Top:=100, Width:=100, Height:=12)
 .WebCheckBox.Selected = msoTrue
 End With
End Sub


MasterPages.Count Property (Publisher)

 Copy code hover
[image]

MasterPages.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a MasterPages object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


WebCheckBox Object (Publisher)

 Copy code hover
[image]

WebCheckBox Object (Publisher)
Send feedback

Represents a Web check box control. The WebCheckBox object is a member of the Shape object.

Example

Use the AddWebControl method to create a Web check box. Use the WebCheckBox property to access a Web check box control shape. This example creates a new Web check box and specifies that its default state is checked; then it adds a text box next to it to describe it.

Copy code Copy code
Sub CreateNewWebCheckBox()
 With ActiveDocument.Pages(1).Shapes
 With .AddWebControl(Type:=pbWebControlCheckBox, Left:=100, _
 Top:=123, Width:=17, Height:=12).WebCheckBox
 .Selected = msoTrue
 End With
 With .AddTextbox(Orientation:=pbTextOrientationHorizontal, _
 Left:=118, Top:=120, Width:=70, Height:=15)
 .TextFrame.TextRange.Text = "Description text for Web check box"
 End With
 End With
End Sub


Shape.RemoveCatalogMergeArea Method (Publisher)

 Copy code hover
[image]

Shape.RemoveCatalogMergeArea Method (Publisher)
Send feedback

Deletes the catalog merge area from the specified publication page. All shapes contained in the catalog merge area remain in place on the page, but are no longer connected to the catalog merge data source.

Syntax

expression .RemoveCatalogMergeArea

expression A variable that represents a Shape object.

Remarks

Removing a catalog merge area from a publication page does not disconnect the data source from the publication. Use the IsDataSourceConnected property of the Document object to determine if a data source is connected to a publication.

Use the AddCatalogMergeArea method of the Shapes collection to add a catalog merge area to a publication. A publication page can contain only one catalog merge area.

Example

The following example tests whether any page in the specified publication contains a catalog merge area. If any page does, all the shapes are removed from the catalog merge area and deleted, and the catalog merge area is then removed from the publication.

Copy code Copy code
Sub DeleteCatalogMergeAreaAndAllShapesWithin()
 Dim pgPage As Page
 Dim mmLoop As Shape
 Dim intCount As Integer
 Dim strName As String

 For Each pgPage In ThisDocument.Pages
 For Each mmLoop In pgPage.Shapes

 If mmLoop.Type = pbCatalogMergeArea Then
 With mmLoop.CatalogMergeItems
 For intCount = .Count To 1 Step -1
 strName = mmLoop.CatalogMergeItems.Item(intCount).Name
 .Item(intCount).RemoveFromCatalogMergeArea
 pgPage.Shapes(strName).Delete
 Next
 End With
 mmLoop.RemoveCatalogMergeArea
 End If

 Next mmLoop
 Next pgPage

 End Sub


ShapeRange.RerouteConnections Method (Publisher)

 Copy code hover
[image]

ShapeRange.RerouteConnections Method (Publisher)
Send feedback

Reroutes connectors so that they take the shortest possible path between the shapes they connect. To do this, the RerouteConnections method may detach the ends of a connector and reattach them to different connecting sites on the connected shapes.

Syntax

expression .RerouteConnections

expression A variable that represents a ShapeRange object.

Return Value

Nothing

Remarks

This method reroutes all connectors attached to the specified shape; if the specified shape is a connector, it is rerouted.

Example

This example adds two rectangles to the first page in the active publication and connects them with a curved connector. Note that the RerouteConnections method overrides the values you supply for the ConnectionSite arguments used with the BeginConnect and EndConnect methods.

Copy code Copy code
Dim shpRect1 As Shape
Dim shpRect2 As Shape

With ActiveDocument.Pages(1).Shapes

 ' Add two new rectangles.
 Set shpRect1 = .AddShape(Type:=msoShapeRectangle, _
 Left:=100, Top:=50, Width:=200, Height:=100)
 Set shpRect2 = .AddShape(Type:=msoShapeRectangle, _
 Left:=300, Top:=300, Width:=200, Height:=100)

 ' Add a new curved connector.
 With .AddConnector(Type:=msoConnectorCurve, _
 BeginX:=0, BeginY:=0, EndX:=100, EndY:=100) _
 .ConnectorFormat

 ' Connect the new connector to the two rectangles.
 .BeginConnect ConnectedShape:=shpRect1, ConnectionSite:=1
 .EndConnect ConnectedShape:=shpRect2, ConnectionSite:=1

 ' Reroute the connector to create the shortest path.
 .Parent.RerouteConnections
 End With

End With


ObjectVerbs Methods (Publisher)

 Copy code hover
[image]

ObjectVerbs Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Item | Returns an individual object in a specified collection.


Attachments.ClearAll Method (Publisher)

 Copy code hover
[image]

Attachments.ClearAll Method (Publisher)
See also Send feedback

Clears (deletes) all the Attachment objects in the parent Attachments collection of an e-mail merge message.

Version Information

Version Added: Publisher 2007

Syntax

expression .ClearAll

expression A variable that represents an Attachments collection.

Remarks

To clear an individual attachment, use the Delete method of the specific Attachment object

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to clear all the attachment to the message in an e-mail merge. The code prints the number of current attachments to the message in the Immediate window and then deletes all of the Attachment objects in the collection.

VBA Copy code Copy code
Public Sub ClearAll_Example()

 Dim pubAttachments As Publisher.Attachments

 Dim pubMailMerge As Publisher.MailMerge
 Dim pubEmailMergeEnvelope As Publisher.EmailMergeEnvelope

 Set pubMailMerge = ThisDocument.MailMerge
 Set pubEmailMergeEnvelope = pubMailMerge.EmailMergeEnvelope
 Set pubAttachments = pubEmailMergeEnvelope.Attachemts

 Debug.Print pubAttachments.Count
 pubAttachments.ClearAll

End Sub

See also

Concepts

Attachments Collection

Other resources

Attachments Object Members


PbWrapType Enumeration (Publisher)

 Copy code hover
[image]

PbWrapType Enumeration (Publisher)
Send feedback

Indicates how text wraps around the specified shape.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbWrapTypeMixed | -1 | Mixed
pbWrapTypeNone | 0 | None
pbWrapTypeSquare | 1 | Square
pbWrapTypeThrough | 3 | Through
pbWrapTypeTight | 2 | Tight
pbWrapTypeTopAndBottom | 4 | Top and Bottom


Printer.IsColor Property (Publisher)

 Copy code hover
[image]

Printer.IsColor Property (Publisher)
Send feedback

Returns True if the device represented by the parent Printer object is a color printer. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .IsColor

expression A variable that represents a Printer object.

Return Value

Boolean


TextRange.Collapse Method (Publisher)

 Copy code hover
[image]

TextRange.Collapse Method (Publisher)
Send feedback

Collapses a range or selection to the starting position or ending position. After a range or selection is collapsed, the starting point and the ending point are equal.

Syntax

expression .Collapse(Direction)

expression A variable that represents a TextRange object.

Parameters

Name | Required/Optional | Data Type | Description
Direction | Required | PbCollapseDirection | The direction in which to collapse the range or selection.

Remarks

If you use pbCollapseEnd to collapse a range that refers to an entire paragraph, the range will be located after the ending paragraph mark (the beginning of the next paragraph). However, you can move the range back one character by using the MoveEnd method after the range is collapsed.

The Direction parameter can be one of the following PbCollapseDirection constants declared in the Microsoft Publisher type library.

pbCollapseEnd

pbCollapseStart

Example

This example inserts text at the beginning of the second paragraph in the first shape on the first page of the active publication. This example assumes that the specified shape is a text frame and not another type of shape.

VBA Copy code Copy code
Sub CollapseRange()
 Dim rngText As TextRange
 Set rngText = ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange

 'Collapses range to the end of the range and
 'enters new text and a new paragraph
 With rngText
 .Paragraphs(Start:=1, Length:=1).Collapse Direction:=pbCollapseEnd
 .Text = "This is a new paragraph." & vbCrLf
 End With
End Sub

This example places new text at the end of the first paragraph in the first shape on the first page of the active publication. This example assumes that the specified shape is a text frame and not another type of shape.

VBA Copy code Copy code
Sub CollapseSelection()
 ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange _
 .Paragraphs(Start:=1, Length:=1).Select

 'Collapses selection to end and moves cursor back
 'one character, then enters new text
 With Selection.TextRange
 .Collapse Direction:=pbCollapseEnd
 .MoveEnd Unit:=pbTextUnitCharacter, Size:=-1
 .Text = " This is a new test."
 End With
End Sub


ColorFormat.RGB Property (Publisher)

 Copy code hover
[image]

ColorFormat.RGB Property (Publisher)
Send feedback

Returns or sets an MsoRGBType that represents the red-green-blue (RGB) value of the specified color. Read/write.

Syntax

expression .RGB

expression A variable that represents a ColorFormat object.

Return Value

MsoRGBType

Example

This example creates a new shape to the first page of the active publication and sets the fill color to red.

Copy code Copy code
Sub SetFill()
 ActiveDocument.Pages(1).Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=100, Top:=100, Width:=100, Height:=100).Fill.ForeColor _
 .RGB = RGB(Red:=255, Green:=0, Blue:=0)
End Sub

This example returns the value of the foreground color of the first shape on the first page of the active document. This example assumes that there is at least one shape on the first page of the active publication.

Copy code Copy code
Sub ShowFillColor()
 MsgBox "The RGB fill value of this shape is " & _
 ActiveDocument.Pages(1).Shapes(1).Fill.ForeColor.RGB & "."
End Sub


ParagraphFormat.WidowControl Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.WidowControl Property (Publisher)
Send feedback

Sets or returns an MsoTriState that represents whether or not the first or last line of the specified paragraph can appear by itself in a text box. Read/write.

Syntax

expression .WidowControl

expression A variable that represents a ParagraphFormat object.

Return Value

MsoTriState

Remarks

This option ensures that the first or last line of the specified paragraph will not appear by itself in a text frame. For example, if the last line in a specified paragraph is the first line of a widow controlled paragraph, a second line will be moved to the next text frame with it.

The WidowControl property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The first or last line may appear by itself in a text box.
msoTrue | The first or last line will not appear by itself in a text box.

The default setting for this property is msoFalse.

Example

This example sets the WidowControl property to msoTrue for the specified ParagraphFormat object.

VBA Copy code Copy code
Dim objParaForm As ParagraphFormat
Set objParaForm = ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.Paragraphs(1).ParagraphFormat
objParaForm.WidowControl = msoTrue


WrapFormat.Parent Property (Publisher)

 Copy code hover
[image]

WrapFormat.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a WrapFormat object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


MailMergeDataField Properties (Publisher)

 Copy code hover
[image]

MailMergeDataField Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Creator | Returns a Long that represents the application in which the specified object was created. For example, if the object was created in Microsoft Publisher, this property returns the hexadecimal number 4D505542, which represents the string "MSPB." This value can also be represented by the constant.
FieldType |
Index | Returns a Long that represents the position of a particular item in a specified collection. .
IsMapped | Indicates if the parent MailMergeDataField object is mapped to a recipient field in the master data source (combined mail-merge recipient list). Read-only.
MappedTo | Returns the name of the recipient field (column) in the master data source (combined mail-merge recipient list) that the parent MailMergeDataField object is mapped to. Read-only.
Name | Returns a String value indicating the name of the specified object. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Value | Returns a String that represents the value of a mail merge data field record or a mapped data field. Read-only.


RulerGuide.Position Property (Publisher)

 Copy code hover
[image]

RulerGuide.Position Property (Publisher)
Send feedback

Returns or sets a Variant representing the font position relative to the baseline of the text in the specified range. Positive values move the text above the normal baseline, negative values move the text below the baseline. Indeterminate values are returned as -9999.0. Read/write.

Syntax

expression .Position

expression A variable that represents a RulerGuide object.

Example

This example adjusts the text in the second story to 5 points below the baseline.

Copy code Copy code
Sub Position()

 Application.ActiveDocument.Stories(2).TextRange.Font.Position = -5

End Sub


MasterPages.Add Method (Publisher)

 Copy code hover
[image]

MasterPages.Add Method (Publisher)
Send feedback

Adds a new Page object to the specified MasterPages object and returns the new Page object.

Syntax

expression .Add(IsTwoPageMaster, Abbreviation, Description, )

expression A variable that represents a MasterPages object.

Parameters

Name | Required/Optional | Data Type | Description
IsTwoPageMaster | Optional | Boolean | True if the master page will be part of a two page spread.
Abbreviation | Optional | String | The abbreviation, or short name, for the master page. An error occurs if this is not unique.
Description | Optional | String | The description for the master page.

Return Value

Page

Example

The following example adds a new master page to the active document.

VBA Copy code Copy code
ActiveDocument.MasterPages.Add _
 IsTwoPageMaster:=False, _
 Abbreviation:="X", _
 Description:="Master Page X"


ShadowFormat Methods (Publisher)

 Copy code hover
[image]

ShadowFormat Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
IncrementOffsetX | Incrementally changes the horizontal offset of the shadow by the specified distance.
IncrementOffsetY | Incrementally changes the vertical offset of the shadow by the specified distance.


Options Properties (Publisher)

 Copy code hover
[image]

Options Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
AddHebDoubleQuote | True for Microsoft Publisher to display double quotes for Hebrew alphabet numbering. Default is False. Read/write Boolean.
AllowBackgroundSave | True (default) for Microsoft Publisher to save publications in the background, allowing users to perform other actions at the same time. Read/write Boolean.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
AutoFormatWord | True for Microsoft Publisher to automatically format the entire word at the cursor position, even when no text is selected. Read/write Boolean.
AutoHyphenate | True (default) for Microsoft Publisher to automatically hyphenate text in text frames. Read/write Boolean.
AutoKeyboardSwitching | True for Microsoft Publisher to automatically switch the keyboard language to the language used for the text at the cursor position. Read/write Boolean.
AutoSelectWord | True for Microsoft Publisher to automatically select the entire word when selecting text. Read/write Boolean.
DefaultPubDirection | Returns or sets a PbDirectionType constant that represents the default direction in which text flows when a new publication is created. Read/write.
DefaultTextFlowDirection | Returns or sets a PbDirectionType constant that represents a global Microsoft Publisher option, indicating whether text flows from left to right or from right to left in a publication. Read/write.
DisplayStatusBar | True for Microsoft Publisher to show the status bar at the bottom of the Publisher window. Read/write Boolean.
DragAndDropText | True to enable dragging of text. Read/write Boolean.
HyphenationZone | Returns or sets a Variant that represents the maximum amount of space that Microsoft Publisher leaves between the end of the last word in a line and the right margin. Read/write.
MeasurementUnit | Returns or sets a PbUnitType constant representing the standard measurement unit for Microsoft Publisher. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
PathForPictures | Returns a String that represents the default path for picture files. Read.
PathForPublications | Returns a String that represents the default folder for publications. Read.
SaveAutoRecoverInfo | True if Microsoft Publisher automatically saves publications for recovery if the application is unexpectedly shut down. Read/write Boolean.
SaveAutoRecoverInfoInterval | Returns or sets a Long that represents the time interval in minutes for automatically saving a publication for recovery if the application is unexpectedly shut down. Read/write.
SequenceCheck | True to check the sequence of independent characters for Asian text. Read/write Boolean.
ShowBasicColors | Returns or sets a Boolean indicating whether Microsoft Publisher shows basic colors in the color palette; True to show basic colors in the palette. Read/write.
ShowScreenTipsOnObjects | True for Microsoft Publisher to display ScreenTips when the mouse pointer hovers over a text box, shape or other object. Read/write Boolean.
ShowTipPages | True for Microsoft Publisher to display tippages in balloons. Read/write Boolean.
TypeNReplace | True for Microsoft Publisher to replace unreadable Asian character clusters resulting from invalid keyboard sequences. Read/write Boolean.
UseCatalogAtStartup | True for Microsoft Publisher to show the catalog when starting. Read/write Boolean.
UseWizardForBlankPublication | Gets or sets whether to use a wizard for blank publications. Read/Write.


ParagraphFormat.Parent Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a ParagraphFormat object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


AdvancedPrintOptions.HorizontalFlip Property (Publisher)

 Copy code hover
[image]

AdvancedPrintOptions.HorizontalFlip Property (Publisher)
See also Send feedback

True to print a horizontally mirrored image of the specified publication. The default is False. Read/write Boolean.

Syntax

expression .HorizontalFlip

expression A variable that represents an AdvancedPrintOptions object.

Remarks

This property is accessible only if the active printer is a PostScript printer. Returns a run-time error if a non-PostScript printer is specified. Use the IsPostscriptPrinter property of the AdvancedPrintOptions object to determine if the specified printer is a PostScript printer.

This property is saved as an application setting and applied to future instances of Microsoft Publisher.

This property corresponds to the Flip horizontally control on the Page Settings tab of the Advanced Print Settings dialog box.

This property is mostly used when printing to film on an imagesetter so that the image reads correctly when the emulsion side of the film is down (as when burning a press plate).

Example

The following example determines if the active printer is a PostScript printer. If it is, the active publication is set to print as a horizontally mirrored and vertically mirrored, negative image of itself.

VBA Copy code Copy code
Sub PrepToPrintToFilmOnImagesetter()

With ActiveDocument.AdvancedPrintOptions
 If .IsPostscriptPrinter = True Then
 .HorizontalFlip = True
 .VerticalFlip = True
 .NegativeImage = True
 End If
End With

End Sub

See also

Concepts

AdvancedPrintOptions Object

Other resources

AdvancedPrintOptions Object Members


ConnectorFormat Members (Publisher)

 Copy code hover
[image]

ConnectorFormat Members (Publisher)
Send feedback

Contains properties and methods that apply to connectors. A connector is a line that attaches two other shapes at points called connection sites. If you rearrange shapes that are connected, the geometry of the connector will be automatically adjusted so that the shapes remain connected.

Methods

Name | Description
BeginConnect | Attaches the beginning of the specified connector to a specified shape.
BeginDisconnect | Detaches the beginning of the specified connector from the shape to which it is attached.
EndConnect | Attaches the end of the specified connector to a specified shape.
EndDisconnect | Detaches the end of the specified connector from the shape to which it is attached.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
BeginConnected | Returns an MsoTriState constant indicating whether the beginning of the specified connector is connected to a shape. Read-only.
BeginConnectedShape | Returns a Shape object that represents the shape to which the beginning of the specified connector is attached.
BeginConnectionSite | Returns a Long indicating the connection site to which the beginning of a connector is connected. Read-only.
EndConnected | Returns an MsoTriState constant indicating whether the end of the specified connector is connected to a shape. Read-only.
EndConnectedShape | Returns a Shape object that represents the shape to which the end of the specified connector is attached.
EndConnectionSite | Returns a Long indicating the connection site to which the end of a connector is connected. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Type | Returns or sets an MsoConnectorType constant that represents the connector type. Read/write.


Application.MailMergeDataSourceLoad Event (Publisher)

 Copy code hover
[image]

Application.MailMergeDataSourceLoad Event (Publisher)
See also Send feedback

Occurs when the data source is loaded for a mail merge.

Syntax

expression .MailMergeDataSourceLoad(Doc)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The mail merge main document.

Remarks

To access the Application object events, declare an Application object variable in the General Declarations section of a code module. Then set the variable equal to the Application object for which you want to access events. For information about using events with the Microsoft Publisher Application object, see Using Events with the Application Object.

Example

This example displays a message with the data source file name when the data source starts loading.

Copy code Copy code
Private Sub MailMergeApp_MailMergeDataSourceLoad(ByVal Doc As Document)
 Dim strDSName As String
 Dim intDSLength As Integer
 Dim intDSStart As Integer

 'Pull out of the Name property (which includes path and file name)
 'only the file name using Visual Basic commands Len, InStrRev, and Right
 intDSLength = Len(ActiveDocument.MailMerge.DataSource.Name)
 intDSStart = InStrRev(ActiveDocument.MailMerge.DataSource.Name, "\")
 intDSStart = intDSLength - intDSStart
 strDSName = Right(ActiveDocument.MailMerge.DataSource.Name, intDSStart)

 'Deliver a message to user when data source is loading
 MsgBox "Your data source, " & strDSName & ", is now loading."
End Sub

For this event to occur, you must place the following line of code in the General Declarations section of your module and run the following initialization routine.

Copy code Copy code
Private WithEvents MailMergeApp As Application

Sub InitializeMailMergeApp()
 Set MailMergeApp = Publisher.Application
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Hyperlink.Shape Property (Publisher)

 Copy code hover
[image]

Hyperlink.Shape Property (Publisher)
Send feedback

Returns a Shape object that represents the shape associated with a hyperlink.

Syntax

expression .Shape

expression A variable that represents a Hyperlink object.

Return Value

Shape

Example

This example adds a hyperlink to the first shape on the first page of the active publication and then vertically flips the shape. This example assumes there is at least one shape on the first page of the active publication.

VBA Copy code Copy code
Sub FormatHyperlinkShape()
 With ActiveDocument.Pages(1).Shapes(1).Hyperlink
 .Address = "http://www.tailspintoys.com/"
 .Shape.Flip FlipCmd:=msoFlipVertical
 End With
End Sub


Attachments.Application Property (Publisher)

 Copy code hover
[image]

Attachments.Application Property (Publisher)
See also Send feedback

Returns an Application object that represents the creator of the parent Attachments collection. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .Application

expression A variable that represents an Attachments collection.

Return Value

Application

See also

Concepts

Attachments Collection

Other resources

Attachments Object Members


TextRange.InsertBefore Method (Publisher)

 Copy code hover
[image]

TextRange.InsertBefore Method (Publisher)
Send feedback

Appends a string to the beginning of the specified text range. Returns a TextRange object that represents the appended text. When used without an argument, this method returns a zero-length string at the end of the specified range.

Syntax

expression .InsertBefore(NewText)

expression A variable that represents a TextRange object.

Parameters

Name | Required/Optional | Data Type | Description
NewText | Required | String | The text to be inserted. The default value is an empty string.

Return Value

TextRange

Example

This example adds the Microsoft Publisher build number and a paragraph break to the beginning of the first shape on the first page of the active publication. This example assumes the specified shape is a text frame and not another type of shape.

Copy code Copy code
Sub InsertTextBefore()
 With ActiveDocument.Pages(1).Shapes(1)
 .TextFrame.TextRange.InsertBefore _
 NewText:="Microsoft Publisher Build : " & Build & vbCrLf
 End With
End Sub


PictureFormat.CropRight Property (Publisher)

 Copy code hover
[image]

PictureFormat.CropRight Property (Publisher)
Send feedback

Returns or sets a Variant indicating the amount by which the right edge of a picture or OLE object is cropped. Read/write.

Syntax

expression .CropRight

expression A variable that represents a PictureFormat object.

Return Value

Variant

Remarks

Numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

Negative values crop the bottom edge away from the center of the frame and positive values crop toward the left edge of the frame.

The valid range of crop values depends on the frame's position and size. For an unrotated frame, the lowest negative value allowed is the distance between the right edge of frame and the right edge of the scratch area. The highest positive value allowed is the current frame width.

Cropping is calculated relative to the original size of the picture. For example, if you insert a picture that is originally 100 points wide, rescale it so that it is 200 points wide, and then set the CropRight property to 50, 100 points (not 50) will be cropped off the right of your picture.

Use the CropLeft, CropTop, and CropBottom properties to crop other edges of a picture or OLE object.

Example

This example crops 20 points off the right of the third shape in the active publication. For the example to work, the shape must be either a picture or an OLE object.

Copy code Copy code
ActiveDocument.Pages(1).Shapes(3).PictureFormat _
 .CropRight = 20

This example crops the percentage specified by the user off the right of the selected shape, regardless of whether the shape has been scaled. For the example to work, the selected shape must be either a picture or an OLE object.

Copy code Copy code
Dim sngPercent As Single
Dim shpCrop As Shape
Dim sngPoints As Single
Dim sngWidth As Single

sngPercent = InputBox("What percentage do you " & _
 "want to crop off the right of this picture?")

Set shpCrop = Selection.ShapeRange(1)
With shpCrop.Duplicate
 .ScaleWidth Factor:=1, _
 RelativeToOriginalSize:=True
 sngWidth = .Width
 .Delete
End With

sngPoints = sngWidth * sngPercent / 100

shpCrop.PictureFormat.CropRight = sngPoints


FillFormat.UserPicture Method (Publisher)

 Copy code hover
[image]

FillFormat.UserPicture Method (Publisher)
Send feedback

Fills the specified shape with one large image.

Syntax

expression .UserPicture(PictureFile)

expression A variable that represents a FillFormat object.

Parameters

Name | Required/Optional | Data Type | Description
PictureFile | Required | String | The name of the picture file.

Remarks

To fill the shape with small tiles of an image, use the UserTextured method.

Example

This example adds two rectangles to the active publication. The rectangle on the left is filled with one large image of a picture; the rectangle on the right is filled with many small tiles of the same picture. (Note that PathToFile must be replaced with a valid file path for this example to work.)

Copy code Copy code
With ActiveDocument.Pages(1).Shapes
 .AddShape(Type:=msoShapeRectangle, _
 Left:=0, Top:=0, Width:=200, Height:=100).Fill _
 .UserPicture PictureFile:="PathToFile"
 .AddShape(Type:=msoShapeRectangle, _
 Left:=300, Top:=0, Width:=200, Height:=100).Fill _
 .UserTextured TextureFile:="PathToFile"
End With


WebListBoxItems.Application Property (Publisher)

 Copy code hover
[image]

WebListBoxItems.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a WebListBoxItems object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


BuildingBlock.Category Property (Publisher)

 Copy code hover
[image]

BuildingBlock.Category Property (Publisher)
Send feedback

Gets or sets a string that represents the category for the building block. Read/Write.

Syntax

expression .Category

expression A variable that represents a BuildingBlock object.


PictureFormat.Replace Method (Publisher)

 Copy code hover
[image]

PictureFormat.Replace Method (Publisher)
Send feedback

Replaces the specified picture. Returns Nothing.

Syntax

expression .Replace(Pathname, InsertAs)

expression A variable that represents a PictureFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Pathname | Required | String | The name and path of the file with which you want to replace the specified picture.
InsertAs | Optional | PbPictureInsertAs | The manner in which you want the picture file inserted into the document: linked or embedded.

Remarks

Use the Replace method to update linked picture files that have been modified since they were inserted into the document. Use the LinkedFileStatus property of the PictureFormat object to determine if a linked picture has been modified.

The InsertAs parameter can be one of the following PbPictureInsertAs constants declared in the Microsoft Publisher type library. the default value is pbPictureInsertAsOriginalState.

pbPictureInsertAsEmbedded

pbPictureInsertAsLinked

pbPictureInsertAsOriginalState

Example

The following example replaces every occurrence of a specific picture in the active publication with another picture.

VBA Copy code Copy code
Sub ReplaceLogo()

Dim pgLoop As Page
Dim shpLoop As Shape
Dim strExistingArtName As String
Dim strReplaceArtName As String

strExistingArtName = "C:\path\logo 1.bmp"
strReplaceArtName = "C:\path\logo 2.bmp"

For Each pgLoop In ActiveDocument.Pages
 For Each shpLoop In pgLoop.Shapes
 If shpLoop.Type = pbLinkedPicture Then

 With shpLoop.PictureFormat
 If .Filename = strExistingArtName Then
 .Replace (strReplaceArtName)
 End If
 End With

 End If

 Next shpLoop
Next pgLoop

End Sub

This example tests each linked picture to determine if the linked file has been modified since it was inserted into the publication. If it has, the picture is updated by replacing the file with itself.

VBA Copy code Copy code
Sub UpdateModifiedLinkedPictures()

Dim pgLoop As Page
Dim shpLoop As Shape
Dim strPictureName As String

For Each pgLoop In ActiveDocument.Pages
 For Each shpLoop In pgLoop.Shapes
 If shpLoop.Type = pbLinkedPicture Then

 With shpLoop.PictureFormat
 If .LinkedFileStatus = pbLinkedFileModified Then
 strPictureName = .Filename
 .Replace (strPictureName)
 End If
 End With

 End If
 Next shpLoop
Next pgLoop

End Sub


pbPresetWordArt Enumeration (Publisher)

 Copy code hover
[image]

pbPresetWordArt Enumeration (Publisher)
Send feedback

Constants that specify the type of preset WordArt, passed to the Shapes.AddWordArt method and passed to and returned by the TextEffectFormat.PresetWordArt property.

Version Information

Version Added: Publisher 2010

Name | Value | Description
pbPresetWordArt1 | 0 | Style 1
pbPresetWordArt2 | 1 | Style 2
pbPresetWordArt3 | 2 | Style 3
pbPresetWordArt4 | 3 | Style 4
pbPresetWordArt5 | 4 | Style 5
pbPresetWordArt6 | 5 | Style 6
pbPresetWordArt7 | 6 | Style 7
pbPresetWordArt8 | 7 | Style 8
pbPresetWordArt9 | 8 | Style 9
pbPresetWordArt10 | 9 | Style 10
pbPresetWordArt11 | 10 | Style 11
pbPresetWordArt12 | 11 | Style 12
pbPresetWordArt13 | 12 | Style 13
pbPresetWordArt14 | 13 | Style 14
pbPresetWordArt15 | 14 | Style 15
pbPresetWordArt16 | 15 | Style 16
pbPresetWordArt17 | 16 | Style 17
pbPresetWordArt18 | 17 | Style 18
pbPresetWordArt19 | 18 | Style 19
pbPresetWordArt20 | 19 | Style 20
pbPresetWordArt21 | 20 | Style 21
pbPresetWordArt22 | 21 | Style 22
pbPresetWordArt23 | 22 | Style 23
pbPresetWordArt24 | 23 | Style 24
pbPresetWordArt25 | 24 | Style 25
pbPresetWordArt26 | 25 | Style 26
pbPresetWordArt27 | 26 | Style 27
pbPresetWordArt28 | 27 | Style 28
pbPresetWordArt29 | 28 | Style 29
pbPresetWordArt30 | 29 | Style 30
pbPresetWordArt31 | 30 | Style 31
pbPresetWordArt32 | 31 | Style 32
pbPresetWordArt33 | 32 | Style 33
pbPresetWordArt34 | 33 | Style 34
pbPresetWordArt35 | 34 | Style 35
pbPresetWordArt36 | 35 | Style 36
pbPresetWordArt37 | 36 | Style 37
pbPresetWordArt38 | 37 | Style 38
pbPresetWordArt39 | 38 | Style 39
pbPresetWordArt40 | 39 | Style 40
pbPresetWordArt41 | 40 | Style 41
pbPresetWordArt42 | 41 | Style 42
pbPresetWordArt43 | 42 | Style 43
pbPresetWordArt44 | 43 | Style 44
pbPresetWordArt45 | 44 | Style 45
pbPresetWordArt46 | 45 | Style 46
pbPresetWordArt47 | 46 | Style 47
pbPresetWordArt48 | 47 | Style 48
pbPresetWordArt49 | 48 | Style 49
pbPresetWordArt50 | 49 | Style 50
pbPresetWordArt51 | 50 | Style 51
pbPresetWordArt52 | 51 | Style 52
pbPresetWordArt53 | 52 | Style 53
pbPresetWordArt54 | 53 | Style 54
pbPresetWordArt55 | 54 | Style 55
pbPresetWordArt56 | 55 | Style 56
pbPresetWordArt57 | 56 | Style 57
pbPresetWordArt58 | 57 | Style 58
pbPresetWordArt59 | 58 | Style 59
pbPresetWordArt60 | 59 | Style 60
pbPresetWordArtMixed | -2 | A combination of styles


FillFormat.GradientDegree Property (Publisher)

 Copy code hover
[image]

FillFormat.GradientDegree Property (Publisher)
Send feedback

Returns a Single indicating how dark or light a one-color gradient fill is. A value of 0 (zero) means that black is mixed in with the shape's foreground color to form the gradient; a value of 1 means that white is mixed in; and values between 0 and 1 mean that a darker or lighter shade of the foreground color is mixed in. Read-only.

Syntax

expression .GradientDegree

expression A variable that represents a FillFormat object.

Return Value

Single

Remarks

Use the OneColorGradient method to set the gradient degree for the fill.

Example

This example adds a rectangle to the active publication and sets the degree of its fill gradient to match that of the shape named Rectangle 2. If Rectangle 2 doesn't have a one-color gradient fill, this example generates an error.

Copy code Copy code
Dim sngDegree As Single

With ActiveDocument.Pages(1).Shapes
 ' Store degree of one-color gradient.
 sngDegree = .Item("Rectangle 2").Fill.GradientDegree
 ' Add new rectangle.
 With .AddShape(msoShapeRectangle, 0, 0, 40, 80).Fill
 ' Set color and gradient for new rectangle.
 .ForeColor.RGB = RGB(128, 0, 0)
 .OneColorGradient Style:=msoGradientHorizontal, _
 Variant:=1, Degree:=sngDegree
 End With
End With


Cell Members (Publisher)

 Copy code hover
[image]

Cell Members (Publisher)
Send feedback

Represents a single table cell. The Cell object is a member of the CellRange collection. The CellRange collection represents all the cells in the specified object.

Methods

Name | Description
Merge | Merges the specified table cell with another cell. The result is a single table cell.
Select | Selects the specified object.
Split | Splits a merged table cell back into its constituent cells. Returns a CellRange object representing the constituent cells.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
BorderBottom | Returns a CellBorder object that represents the bottom border for a specified table cell.
BorderDiagonal | Returns a CellBorder object that represents the diagonal border for a specified table cell.
BorderLeft | Returns a CellBorder object that represents the left border for a specified table cell.
BorderRight | Returns a CellBorder object that represents the right border for a specified table cell.
BorderTop | Returns a CellBorder object that represents the top border for a specified table cell.
CellTextOrientation | Returns or sets a PbTextOrientation that represents the flow of text in a specified table cell. Read/write.
Column | Returns a Long that represents the table column containing the specified cell. Read-only.
Diagonal | Sets or returns a PbCellDiagonalType constant that represents a cell that is diagonally split. Read/write.
Fill | Returns a FillFormat object representing the fill for the specified shape or table cell.
HasText | Returns a Boolean value indicating whether the specified cell contains any text. ReturnsTrue if the specified cell contains text. Read-only.
Height | Returns a Long that represent the height (in cells) of a table, range of cells, or page. Read-only.
MarginBottom | Returns or sets a Variant that represents the amount of space (in points) between the text and the bottom edge of a cell, text frame, or page. Read/write.
MarginLeft | Returns or sets a Variant that represents the amount of space (in points) between the text and the left edge of a cell, text frame, or page. Read/write.
MarginRight | Returns or sets a Variant that represents the amount of space (in points) between the text and the right edge of a cell, text frame, or page. Read/write.
MarginTop | Returns or sets a Variant that represents the amount of space (in points) between the text and the top edge of a cell, text frame, or page. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Row | Returns a Long that represents the row number containing the specified cell. Read-only.
Selected | Returns True if a cell is selected. Read-only Boolean.
TextRange | Returns a TextRange object that represents the text that is attached to a shape and properties and methods for manipulating the text.
VerticalTextAlignment | Returns or sets a PbVerticalTextAlignmentType constant that represents the vertical alignment of text in a text box. Read/write.
Width | Returns a Long that represent the width (in cells) of a table, range of cells, or page. Read-only.


Shape.VerticalFlip Property (Publisher)

 Copy code hover
[image]

Shape.VerticalFlip Property (Publisher)
Send feedback

Returns msoTrue if the specified shape has been flipped around its vertical axis. Read-only.

Syntax

expression .VerticalFlip

expression A variable that represents a Shape object.

Remarks

The property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The shape has not been flipped around its vertical axis.
msoTriStateMixed | Indicates a combination of msoTrue and msoFalse for the specified shape range.
msoTrue | The shape has been flipped around its vertical axis.

Example

This example restores each shape on the active publication to its original state if it has been flipped horizontally or vertically.

VBA Copy code Copy code
Sub Flipper()

 Dim shpBall As Shape

 For Each shpBall In ActiveDocument.MasterPages.Item(1).Shapes
 If shpBall.HorizontalFlip = msoTrue Then shpBall.Flip msoFlipHorizontal
 If shpBall.VerticalFlip = msoTrue Then shpBall.Flip msoFlipVertical
 Next

End Sub


Columns.Add Method (Publisher)

 Copy code hover
[image]

Columns.Add Method (Publisher)
Send feedback

Adds a new Column object to the specified Columns collection and returns the new Column object.

Syntax

expression .Add(BeforeColumn)

expression A variable that represents a Columns object.

Parameters

Name | Required/Optional | Data Type | Description
BeforeColumn | Optional | Long | The number of the column before which to insert the new column. If this argument is omitted, the new column is added after the existing columns. An error occurs if the value of this argument does not correspond to an existing column in the table.

Return Value

Column

Example

The following example adds a column before column three in the specified table.

VBA Copy code Copy code
Dim colNew As Column

Set colNew = ActiveDocument.Pages(1).Shapes(1) _
 .Table.Columns.Add(BeforeColumn:=3)


WizardProperties Object (Publisher)

 Copy code hover
[image]

WizardProperties Object (Publisher)
Send feedback

Represents the settings available in a publication design or in a Design Gallery object's wizard.

Example

Use the Properties property with a Wizard object to return a WizardProperties collection. The following example reports on the publication design associated with the active publication, displaying its name and current settings.

Copy code Copy code
Dim wizTemp As Wizard
Dim wizproTemp As WizardProperty
Dim wizproAll As WizardProperties

Set wizTemp = ActiveDocument.Wizard

With wizTemp
 Set wizproAll = .Properties
 MsgBox "Publication Design associated with " _
 & "current publication: " .Name
 For Each wizproTemp In wizproAll
 With wizproTemp
 Debug.Print " Wizard property: " _
 & .Name & " = " & .CurrentValueId
 End With
 Next wizproTemp
End With
Note Note

Depending on the language version of Microsoft Publisher that you are using, you may receive an error when using the above code. If this occurs, you will need to build in error handlers to circumvent the errors. For more information, see Wizard Object.


Application.Selection Property (Publisher)

 Copy code hover
[image]

Application.Selection Property (Publisher)
See also Send feedback

Returns a Selection object that represents a selected range or the cursor.

Syntax

expression .Selection

expression A variable that represents an Application object.

Example

This example tests whether the current selection is text. If it is text, the selected text is then displayed in a message box.

Copy code Copy code
Sub Selectable()

 If Selection.Type = pbSelectionText Then MsgBox Selection.TextRange

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Document.Close Method (Publisher)

 Copy code hover
[image]

Document.Close Method (Publisher)
Send feedback

Closes the current publication and creates a blank publication in its place.

Syntax

expression .Close

expression A variable that represents a Document object.

Remarks

You can use the Close method only on an open Document object in another instance of Microsoft Publisher. Attempting to close the active publication in the current instance of Publisher causes an error.

Example

This example opens a publication in a new instance of Publisher for modification and then closes the publication. (Note that to make this example work, you must replace Filename with a valid file name .)

VBA Copy code Copy code
Sub ModifyAnotherPublication()

 ' Create new instance of Publisher.
 Dim appPub As New Publisher.Application

 ' Open publication.
 appPub.Open FileName:="Filename"

 ' Put code here to modify the publication as necessary.

 ' Close the publication.
 appPub.ActiveDocument.Close

 ' Release the other instance of Publisher.
 Set appPub = Nothing

End Sub


ColorScheme Object (Publisher)

 Copy code hover
[image]

ColorScheme Object (Publisher)
Send feedback

Represents a color scheme, which is a set of eight colors used for the different elements of a publication. Each color is represented by a ColorFormat object. The ColorScheme object is a member of the ColorSchemes collection. The ColorSchemes collection contains all the color schemes available to Microsoft Publisher.

Example

Use the ColorScheme property of a Document object to return the color scheme for the current publication. The following example sets the fill value of three shapes on the first page to the return value (in RGB format) of three of the eight ColorScheme colors.

Copy code Copy code
Sub ReturnColorsAndApplyToShapes()
 Dim lngAccent1 As Long
 Dim lngAccent2 As Long
 Dim lngAccent3 As Long

 With ActiveDocument
 With .ColorScheme
 lngAccent1 = .Colors(pbSchemeColorAccent1).RGB
 lngAccent2 = .Colors(pbSchemeColorAccent2).RGB
 lngAccent3 = .Colors(pbSchemeColorAccent3).RGB
 End With
 With .Pages(1)
 .Shapes(1).Fill.ForeColor.RGB = lngAccent1
 .Shapes(2).Fill.ForeColor.RGB = lngAccent2
 .Shapes(3).Fill.ForeColor.RGB = lngAccent3
 End With
 End With

End Sub

Use the Name property to return a color scheme name. The following example lists in a text box all the color schemes available to Publisher.

Copy code Copy code
Sub ListColorShemes()

 Dim clrScheme As ColorScheme
 Dim strSchemes As String

 For Each clrScheme In Application.ColorSchemes
 strSchemes = strSchemes & clrScheme.Name & vbLf
 Next
 ActiveDocument.Pages(1).Shapes.AddTextbox( _
 Orientation:=pbTextOrientationHorizontal, _
 Left:=72, Top:=72, Width:=400, Height:=500).TextFrame _
 .TextRange.Text = strSchemes

End Sub


WebHiddenFields.Application Property (Publisher)

 Copy code hover
[image]

WebHiddenFields.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a WebHiddenFields object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Fields.Parent Property (Publisher)

 Copy code hover
[image]

Fields.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a Fields object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Document.ViewTwoPageSpread Property (Publisher)

 Copy code hover
[image]

Document.ViewTwoPageSpread Property (Publisher)
Send feedback

Returns True if the specified publication should be viewed as a two-page spread. Read/write Boolean.

Syntax

expression .ViewTwoPageSpread

expression A variable that represents a Document object.

Return Value

Boolean

Example

This example opens a message box and displays if the current publication should be viewed in the in the two page spread mode.

VBA Copy code Copy code
Sub ViewTwoPage()

 MsgBox "View Two Page Spread = " & _
 Application.ActiveDocument.ViewTwoPageSpread

End Sub


ThreeDFormat.Depth Property (Publisher)

 Copy code hover
[image]

ThreeDFormat.Depth Property (Publisher)
Send feedback

Returns or sets a Variant indicating the depth of the shape's extrusion. Read/write.

Syntax

expression .Depth

expression A variable that represents a ThreeDFormat object.

Return Value

Variant

Remarks

Numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

Positive values produce an extrusion whose front face is the original shape; negative values produce an extrusion whose back face is the original shape. The valid range is -600 through 9600 points, or the equivalent distance in all other units.

Example

This example adds an oval to the active publication, and then specifies that the oval be extruded to a depth of 50 points and that the extrusion be purple.

Copy code Copy code
Dim shpNew As Shape

Set shpNew = ActiveDocument.Pages(1).Shapes _
 .AddShape(Type:=msoShapeOval, _
 Left:=90, Top:=90, Width:=90, Height:=40)

With shpNew.ThreeD
 .Visible = True
 .Depth = 50
 .ExtrusionColor.RGB = RGB(255, 100, 255)
End With


WebTextBox.Limit Property (Publisher)

 Copy code hover
[image]

WebTextBox.Limit Property (Publisher)
Send feedback

Returns or sets a Long that represents the maximum number of characters that can be entered into a Web text box control. Read/write.

Syntax

expression .Limit

expression A variable that represents a WebTextBox object.

Return Value

Long

Remarks

Text box limits can be any number from 1 to 255 characters. Numbers higher than 255 will generate an error.

Example

This example creates a new Web text box control in the active publication, sets the default text and the character limit for the text box, and specifies that it is a required control.

Copy code Copy code
Sub AddWebTextBoxControl()
 With ActiveDocument.Pages(1).Shapes.AddWebControl _
 (Type:=pbWebControlMultiLineTextBox, Left:=72, _
 Top:=72, Width:=300, Height:=100).WebTextBox
 .DefaultText = "Please enter text here."
 .Limit = 200
 .RequiredControl = msoTrue
 End With
End Sub


WizardProperties.Parent Property (Publisher)

 Copy code hover
[image]

WizardProperties.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a WizardProperties object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Application.COMAddIns Property (Publisher)

 Copy code hover
[image]

Application.COMAddIns Property (Publisher)
See also Send feedback

Returns a COMAddIns collection that represents a reference to the Component Object Model (COM) add-ins currently loaded in Microsoft Publisher.

Syntax

expression .COMAddIns

expression A variable that represents a Application object.

Return Value

COMAddIns

Remarks

These are listed in the COM Add-Ins dialog box. You can add the Add-Ins command to your Tools menu by using the Customize dialog box.

See also

Concepts

Application Object

Other resources

Application Object Members


WrapFormat Object (Publisher)

 Copy code hover
[image]

WrapFormat Object (Publisher)
Send feedback

Represents all the properties for wrapping text around a shape or shape range.

Example

Use the TextWrap property to return a WrapFormat object. The following example adds an oval to the active publication and specifies that publication text wrap around the left and right sides of the square that circumscribes the oval. There will be a 0.1-inch margin between the publication text and the top, bottom, left side, and right side of the square.

Copy code Copy code
Sub SetTextWrapFormatProperties()
 Dim shpOval As Shape

 Set shpOval = ActiveDocument.Pages(1).Shapes.AddShape(Type:=msoShapeOval, _
 Left:=36, Top:=36, Width:=100, Height:=35)
 With shpOval.TextWrap
 .Type = pbWrapTypeSquare
 .Side = pbWrapSideBoth
 .DistanceAuto = msoFalse
 .DistanceTop = InchesToPoints(0.1)
 .DistanceBottom = InchesToPoints(0.1)
 .DistanceLeft = InchesToPoints(0.1)
 .DistanceRight = InchesToPoints(0.1)
 End With
End Sub


TextRange.MajorityFont Property (Publisher)

 Copy code hover
[image]

TextRange.MajorityFont Property (Publisher)
Send feedback

Returns a Font object that represents the font name most in use in a text range.

Syntax

expression .MajorityFont

expression A variable that represents a TextRange object.

Return Value

Font

Example

This example creates a new text box, fills it with text, checks if the font most in use is Tahoma, and if it isn't, changes the font to Tahoma.

Copy code Copy code
Sub SetFontName()
 Dim intCount As Integer
 With ActiveDocument.Pages(1).Shapes _
 .AddTextbox(Orientation:=pbTextOrientationHorizontal, _
 Left:=100, Top:=100, Width:=100, Height:=100) _
 .TextFrame.TextRange
 For intCount = 1 To 10
 .InsertAfter NewText:="This is a test. "
 Next intCount
 If .MajorityFont <> "Tahoma" Then _
 .Font.Name = "Tahoma"
 End With
End Sub


Cell.Selected Property (Publisher)

 Copy code hover
[image]

Cell.Selected Property (Publisher)
Send feedback

Returns True if a cell is selected. Read-only Boolean.

Syntax

expression .Selected

expression A variable that represents a Cell object.

Example

This example determines if a cell in the specified table is selected and if it is, enters text into the cell.

VBA Copy code Copy code
Sub IsCellSelected()
 Dim cel As Cell
 With ActiveDocument.Pages(1).Shapes(1).Table
 For Each cel In .Cells
 If cel.Selected Then
 cel.TextRange.Text = "This cell is selected."
 End If
 Next cel
 End With
End Sub


WrapFormat.DistanceBottom Property (Publisher)

 Copy code hover
[image]

WrapFormat.DistanceBottom Property (Publisher)
Send feedback

When the Type property of the WrapFormat object is set to pbWrapTypeSquare, returns or sets a Variant that represents the distance (in points) between the document text and the bottom edge of the specified shape. Read/write.

Syntax

expression .DistanceBottom

expression A variable that represents a WrapFormat object.

Example

This example adds an oval to the active document and specifies that the document text wrap around the left and right sides of the square that circumscribes the oval. The example sets a 0.1-inch margin between the document text and the top, bottom, left side, and right side of the square.

Copy code Copy code
Sub AddNewShape()
 Dim shpOval As Shape

 Set shpOval = ActiveDocument.Pages(1).Shapes _
 .AddShape(Type:=msoShapeOval, Left:=36, _
 Top:=36, Width:=100, Height:=35)
 With shpOval.TextWrap
 .Type = pbWrapTypeSquare
 .Side = pbWrapSideBoth
 .DistanceAuto = msoFalse
 .DistanceTop = InchesToPoints(0.1)
 .DistanceBottom = InchesToPoints(0.1)
 .DistanceLeft = InchesToPoints(0.1)
 .DistanceRight = InchesToPoints(0.1)
 End With
End Sub


WebNavigationBarSet.AutoUpdate Property (Publisher)

 Copy code hover
[image]

WebNavigationBarSet.AutoUpdate Property (Publisher)
Send feedback

True if all pages will be added to the specified Web navigation bar set and that adding new pages will update the navigation bar with a corresponding item. Pages must have the AddHyperlinkToWebNavbar set to True or WebPageOptions.IncludePageOnNewWebNavigationBars property set to True to be added or updated within the specified WebNavigationBarSet. Read/write Boolean.

Syntax

expression .AutoUpdate

expression A variable that represents a WebNavigationBarSet object.

Return Value

Boolean

Remarks

This property determines whether or not the existing pages in the publication will be added to the navigation bar and if added pages will also be updated. These pages must be marked with the AddHyperlinkToWebNavbar set to True or WebPageOptions.IncludePageOnNewWebNavigationBars property set to True to be added or updated within the specified WebNavigationBarSet. Changing this setting does not change the number of items in the bar, it just determines whether or not new pages will be added. By setting this value to False it is possible to design specific navigation bars for specific content pages in a Web site that do not contain all of the available hyperlinks in the publication.

The default value is True.

Example

The following example adds a new Web navigation bar set to the active document with text style buttons and auto update set to False so that page links will not be added or new pages automatically updated in the navigation bar, then the Web navigation bar is added to the first page of the publication.

Copy code Copy code
Dim objWebNav As WebNavigationBarSet
Set objWebNav = ActiveDocument.WebNavigationBarSets.AddSet(Name:="newBar")
With objWebNav
 .AutoUpdate = False
 .ButtonStyle = pbnbButtonStyleText
End With
ActiveDocument.Pages(1).Shapes.AddWebNavigationBar _
 Name:="newBar", Left:=10, Top:=10


WebNavigationBarSets Methods (Publisher)

 Copy code hover
[image]

WebNavigationBarSets Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
AddSet | Adds a new WebNavigationBarSet object representing a Web navigation bar set to the specified WebNavigationBarSets collection. .
Item | Returns an individual object in a specified collection.


FindReplace.MatchWidth Property (Publisher)

 Copy code hover
[image]

FindReplace.MatchWidth Property (Publisher)
Send feedback

Sets or returns a Boolean representing whether or not a search operation will match the character width of the searched text. Read/Write.

Syntax

expression .MatchWidth

expression A variable that represents a FindReplace object.

Return Value

Boolean

Remarks

This property may not be available depending on the language enabled on your operating system. The default value is False.

Return "Access denied" if an East Asian language is not enabled.

Example

The following example finds each occurance of the word "width" in the active document and applies bold formatting. The MatchWidth property is set to False so that full or half width characters will both be found. For example, this search will apply bold formatting to the word "width" (half-width characters) and the word " w i d t h" (full-width characters).

Copy code Copy code
Dim objDocument As Document
Set objDocument = ActiveDocument
With objDocument.Find
 .Clear
 .FindText = "width"
 .MatchWidth = False
 Do While .Execute = True
 .FoundTextRange.Font.Bold = msoTrue
 Loop
End With

The following example finds each occurance of the word "width" in the active document and applies bold formatting. The MatchWidth property is set to True so that either full or half width characters will be found. For example, this search will apply bold formatting to "width". It will not apply formatting to the word "w i d t h".

Copy code Copy code
Dim objDocument As Document
Set objDocument = ActiveDocument
With objDocument.Find
 .Clear
 .FindText = "width"
 .MatchWidth = True
 Do While .Execute = True
 .FoundTextRange.Font.Bold = msoTrue
 Loop
End With


CellRange.Count Property (Publisher)

 Copy code hover
[image]

CellRange.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a CellRange object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


ShadowFormat Object (Publisher)

 Copy code hover
[image]

ShadowFormat Object (Publisher)
Send feedback

Represents shadow formatting for a shape.

Example

Use the Shadow property to return a ShadowFormat object. The following example adds a shadowed rectangle to the active document. The pink shadow is offset 7 points to the right of the rectangle and 7 points above it.

Copy code Copy code
Sub FormatShadow()
 With ActiveDocument.Pages(1).Shapes.AddShape( _
 Type:=msoShapeRectangle, Left:=72, Top:=72, _
 Width:=100, Height:=200).Shadow
 .ForeColor.RGB = RGB(Red:=255, Green:=0, Blue:=150)
 .Obscured = msoTrue
 .OffsetX = 7
 .OffsetY = -7
 .Visible = True
 End With
End Sub


TextFrame.Columns Property (Publisher)

 Copy code hover
[image]

TextFrame.Columns Property (Publisher)
Send feedback

Returns or sets a Long that represents the number of guide columns on a page or the number of columns in a text frame. Read/write.

Syntax

expression .Columns

expression A variable that represents a TextFrame object.


Attachments Properties (Publisher)

 Copy code hover
[image]

Attachments Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the creator of the parent Attachments collection. Read-only.
Count | Returns the number of Attachment objects in the Attachments collection of an EmailMergeEnvelope object. Read-only.
Item | Returns the Attachment object at the specified index position in the Attachments collection. Read-only. .
Parent | Returns the parent of the Attachments collection. Read-only.


Cell.HasText Property (Publisher)

 Copy code hover
[image]

Cell.HasText Property (Publisher)
Send feedback

Returns a Boolean value indicating whether the specified cell contains any text. ReturnsTrue if the specified cell contains text. Read-only.

Syntax

expression .HasText

expression A variable that represents a Cell object.

Example

If shape one on page one contains a table and the first cell of the table contains text, this example displays the text in a message box.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes(1)

 ' Check for table.
 If .HasTable Then
 With .Table.Cells(StartRow:=1, StartColumn:=1, _
 EndRow:=1, EndColumn:=1).Item(1)

 ' Check for text in first cell.
 If .HasText Then
 MsgBox "Text from first cell of table: " _
 & vbCr & .Text
 Else
 MsgBox "No text in first cell."
 End If

 End With
 Else
 MsgBox "No table in shape one."
 End If

End With


CalloutFormat.Angle Property (Publisher)

 Copy code hover
[image]

CalloutFormat.Angle Property (Publisher)
Send feedback

Returns or sets an MsoCalloutAngleType constant that represents the angle of the callout line. If the callout line contains more than one line segment, this property returns or sets the angle of the segment that is farthest from the callout text box. Read/write.

Syntax

expression .Angle

expression A variable that represents a CalloutFormat object.

Remarks

If you set the value of this property to anything other than msoCalloutAngleAutomatic, the callout line maintains a fixed angle as you drag the callout.

MsoCalloutAngleType can be one of these MsoCalloutAngleType constants.

msoCalloutAngle30

msoCalloutAngle45

msoCalloutAngle60

msoCalloutAngle90

msoCalloutAngleAutomatic

msoCalloutAngleMixed

Example

This example sets the callout angle to 90 degrees for the first shape on the first page of the active publication. For this example to work, the specified shape must be a callout.

VBA Copy code Copy code
Sub SetCalloutAngle()
 ActiveDocument.Pages(1).Shapes(1).Callout.Angle = msoCalloutAngle90
End Sub


InlineShapes.Application Property (Publisher)

 Copy code hover
[image]

InlineShapes.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents an InlineShapes object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


ObjectVerbs Properties (Publisher)

 Copy code hover
[image]

ObjectVerbs Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


MailMergeFilterCriterion Properties (Publisher)

 Copy code hover
[image]

MailMergeFilterCriterion Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Column | Returns a String that represents the name of the field in the mail merge data source to use in the filter. Read/write.
CompareTo | Returns or sets a String that represents the text to compare in the query filter criterion. Read/write.
Comparison | Returns or sets an MsoFilterComparison constant that represents how to compare the Column and CompareTo properties. Read/write.
Conjunction | Returns or sets an MsoFilterConjunction constant that represents how a filter criterion relates to other filter criteria in the MailMergeFilters object. Read/write.
Creator | Returns a Long that represents the application in which the specified object was created. For example, if the object was created in Microsoft Publisher, this property returns the hexadecimal number 4D505542, which represents the string "MSPB." This value can also be represented by the constant.
Index | Returns a Long that represents the position of a particular item in a specified collection. .
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


LayoutGuides.HorizontalBaseLineOffset Property (Publisher)

 Copy code hover
[image]

LayoutGuides.HorizontalBaseLineOffset Property (Publisher)
Send feedback

Returns a Single that represents the horizontal baseline offset of the specified LayoutGuides object. Read/Write.

Syntax

expression .HorizontalBaseLineOffset

expression A variable that represents a LayoutGuides object.

Return Value

Single

Remarks

When setting the layout guide properties of a Page object it must be returned from the MasterPages collection.

Example

This example sets the horizontal baseline offset of the layout guides object to 12 for the second master page in the active document.

Copy code Copy code
Dim objLayout As LayoutGuides
Set objLayout = ActiveDocument.MasterPages(2).LayoutGuides
objLayout.HorizontalBaseLineSpacing = 12


Shape.WizardTag Property (Publisher)

 Copy code hover
[image]

Shape.WizardTag Property (Publisher)
Send feedback

Returns or sets a PbWizardTag constant indicating the function of a specified shape with respect to its publication design. Read/write.

Syntax

expression .WizardTag

expression A variable that represents a Shape object.

Remarks

The WizardTag property value can be one of the PbWizardTag constants declared in the Microsoft Publisher type library.

The combination of the WizardTagInstance property and the WizardTag property uniquely defines every shape in a publication.

Example

The following example displays the wizard tag and wizard tag instance information for all the shapes on page one of the active publication.

VBA Copy code Copy code
Dim shpLoop As Shape

For Each shpLoop In ActiveDocument.Pages(1).Shapes
 With shpLoop
 Debug.Print "Shape: " & .Name
 Debug.Print " Wizard tag: " & .WizardTag
 Debug.Print " Wizard tag instance: " _
 & .WizardTagInstance
 End With
Next shpLoop


ParagraphFormat.TextDirection Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.TextDirection Property (Publisher)
Send feedback

Returns or sets a PbTextDirection constant indicating the direction in which text flows in the specified paragraph. Read/write.

Syntax

expression .TextDirection

expression A variable that represents a ParagraphFormat object.

Return Value

PbTextDirection

Remarks

This property is meant to be used in conjunction with documents that have text in both left-to-right and right-to-left languages. Setting the property to a value that is not in accordance with the text direction dictated by the language in use may have unpredictable results.

The TextDirection property value can be one of the PbTextDirection constants declared in the Microsoft Publisher type library and shown in the following table.

Constant | Description
pbTextDirectionLeftToRight | Text flows from left to right.
pbTextDirectionMixed | Return value indicating a range containing some left-to-right text and some right-to-left text.
pbTextDirectionRightToLeft | Text flows from right to left.

Example

The following example changes the text direction of the first shape on page one so that it flows from right-to-left.

VBA Copy code Copy code
ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange _
 .ParagraphFormat.TextDirection = pbTextDirectionRightToLeft


AdvancedPrintOptions.PrintDensityBars Property (Publisher)

 Copy code hover
[image]

AdvancedPrintOptions.PrintDensityBars Property (Publisher)
See also Send feedback

True to print a density bar for the specified publication. The default is True. Read/write Boolean.

Syntax

expression .PrintDensityBars

expression A variable that represents a AdvancedPrintOptions object.

Return Value

Boolean

Remarks

Returns "Permission Denied" if any print mode other than separations is selected for the specified publication.

The density bar printed is graded from a 10 percent screen to a 100 percent fill. A commercial printer can use this bar to determine proper exposure time for plate burning, and to test dot gain in the printed pages.

This property corresponds to the Density bars control on the Page Settings tab of the Advanced Print Settings dialog box.

These printer's marks print outside the publication and can be printed only if the size of the paper being printed on is larger than the publication page size.

Example

The following example sets crop marks and job information to print with the publication. If the publication is printed as separations, the additional types of printer's marks are also set to print. This example assumes that the size of the paper being printed to is larger than the publication page size.

VBA Copy code Copy code
Sub SetPrintersMarksToPrint()
 With ActiveDocument.AdvancedPrintOptions
 .PrintCropMarks = True
 .PrintJobInformation = True
 If PrintMode = pbPrintModeSeparations Then
 .PrintRegistrationMarks = True
 .PrintDensityBars = True
 .PrintColorBars = True
 End If
 End With
End Sub

See also

Concepts

AdvancedPrintOptions Object

Other resources

AdvancedPrintOptions Object Members


BuildingBlocks Members (Publisher)

 Copy code hover
[image]

BuildingBlocks Members (Publisher)
Send feedback

Represents a collection of one or more BuildingBlock objects.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Microsoft Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Count | Returns a Long that represents the number of items in the specified collection.
Item | Returns the specified BuildingBlock object from a BuildingBlocks collection. Read-only.
Parent | Returns an object that represents the parent object of the specified object. Read-only.


Pages.Item Property (Publisher)

 Copy code hover
[image]

Pages.Item Property (Publisher)
Send feedback

Returns the specified Page object from a Pages or MasterPages collection. Read-only.

Syntax

expression .Item(Item)

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
Item | Required | Long | The number of the page to return. For MasterPages collections, Item can either be 1 or 2 for the left and right master pages, respectively. For Pages collections, Item corresponds to a Page object's PageIndex property.

Example

This example displays the page number, page index, and page ID of the first page in the active publication.

VBA Copy code Copy code
With ActiveDocument.Pages.Item(1)
 Debug.Print "Page number = " & .PageNumber
 Debug.Print "Page index = " & .PageIndex
 Debug.Print "Page ID = " & .PageID
End With


LinkFormat Members (Publisher)

 Copy code hover
[image]

LinkFormat Members (Publisher)
Send feedback

Represents the linking characteristics for an OLE object or picture.

Methods

Name | Description
Update | Updates the specified linked OLE object.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
SourceFullName | Returns a String that represents the path and name of the source file for the specified linked OLE object, picture, or field. Read-only.


Stories Members (Publisher)

 Copy code hover
[image]

Stories Members (Publisher)
Send feedback

Represents all the text in a publication.

Methods

Name | Description
Item | Returns an individual object in a specified collection.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


MailMergeDataSource.Name Property (Publisher)

 Copy code hover
[image]

MailMergeDataSource.Name Property (Publisher)
Send feedback

Returns a String value indicating the name of the specified object. Read-only.

Syntax

expression .Name

expression A variable that represents a MailMergeDataSource object.

Remarks

You can use an object's name in conjunction with the Item method or Item property to return a reference to the object if the Item method or property for the collection that contains the object takes a Variant argument. For example, if the value of the Name property for a shape is Rectangle 2, then .Shapes("Rectangle 2") will return a reference to that shape.

The Name property is the default property for the BorderArt, BorderArtFormat, and Label objects.


Options.AutoFormatWord Property (Publisher)

 Copy code hover
[image]

Options.AutoFormatWord Property (Publisher)
Send feedback

True for Microsoft Publisher to automatically format the entire word at the cursor position, even when no text is selected. Read/write Boolean.

Syntax

expression .AutoFormatWord

expression A variable that represents an Options object.

Return Value

Boolean

Remarks

If only one or two characters in a word are selected, only the selected characters are affected by a formatting change, not the whole word.

Example

This example sets global options for Microsoft Publisher, including enabling automatic formatting of the entire word.

Copy code Copy code
Sub SetGlobalOptions()
 With Options
 .AutoFormatWord = True
 .AutoKeyboardSwitching = True
 .AutoSelectWord = True
 .DragAndDropText = True
 .UseCatalogAtStartup = False
 .UseHelpfulMousePointers = False
 End With
End Sub


TextRange Members (Publisher)

 Copy code hover
[image]

TextRange Members (Publisher)
Send feedback

Contains the text that is attached to a shape, in addition to properties and methods for manipulating the text. This topic describes how to:

Methods

Name | Description
Characters | Returns a TextRange object that represents the specified subset of text characters.
Collapse | Collapses a range or selection to the starting position or ending position. After a range or selection is collapsed, the starting point and the ending point are equal.
Copy | Copies the specified object to the Clipboard.
Cut | Deletes the specified object and places it on the Clipboard.
Delete | Deletes the specified object.
Expand | Expands the specified range or selection. Returns or sets a Long that represents the number of specified units added to the range or selection.
InsertAfter | Returns a TextRange object that represents text appended to the end of a text range.
InsertBarcode | Inserts a bar code field at the end of the text range represented by the parent TextRange object.
InsertBefore | Appends a string to the beginning of the specified text range. Returns a TextRange object that represents the appended text. When used without an argument, this method returns a zero-length string at the end of the specified range.
InsertDateTime | Returns a TextRange object that represents the date and time inserted into a specified text range.
InsertMailMergeField | Returns a TextRange object that represents a text data field for a mail merge or catalog merge.
InsertPageNumber | Returns a TextRange object that represents a page number field in a publication.
InsertSymbol | Returns a TextRange object that represents a symbol inserted in place of the specified range or selection.
Lines | Returns a TextRange object that represents the specified lines.
Move | Collapses the specified range to its start position or end position and then moves the collapsed object by the specified number of units. This method returns a Long that represents the number of units by which the object was actually moved, or it returns 0 (zero) if the move was unsuccessful.
MoveEnd | Moves the ending character position of a range. This method returns a Long that represents the number of units the range or selection actually moved or returns 0 (zero) if the move was unsuccessful.
MoveStart | Moves the start position of the specified range. This method returns a Long that indicates the number of units by which the start position or the range or selection actually moved, or it returns 0 (zero) if the move was unsuccessful.
Paragraphs | Returns a TextRange object that represents the specified paragraphs.
Paste | Pastes the text on the Clipboard into the specified text range, and returns a TextRange object that represents the pasted text.
Select | Selects the specified object.
Words | Returns a TextRange object that represents the specified subset of text words.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
BoundHeight | Returns a Single indicating the height, in points, of the bounding box for the specified text range. Read-only.
BoundLeft | Returns a Single indicating the distance, in points, from the left edge of the leftmost page to the left edge of the bounding box for the specified text range. Read-only.
BoundTop | Returns a Single indicating the distance, in points, from the top edge of the topmost page to the top edge of the bounding box for the specified text range. Read-only.
BoundWidth | Returns a Single indicating the width, in points, of the bounding box for the specified text range. Read-only.
ContainingObject | Returns an Object that represents the object that contains the text range. Read-only.
DropCap | Returns a DropCap object that represents a dropped capital letter for the paragraphs in the specified text frame.
Duplicate | Returns a TextRange object that represents a duplicate of the specified text range.
End | Sets or returns a Long that represents the ending character position of a selection or text range. Read/write.
Fields | Returns a Fields object that represents all the fields in the specified text range.
Find | Returns a FindReplace object from the specified TextRange object. The FindReplace object is used to perform a text search and replace in the specified text range.
Font | Sets or returns a Font object that represents character formatting attributes applied to the specified object. Read/write.
Hyperlinks | Returns a Hyperlinks collection representing all the hyperlinks in the specified text range.
InlineShapes | Returns an InlineShapes collection, which represents the inline shapes contained within a text range. Read-only.
LanguageID | Returns or sets a MsoLanguageID constant that represents the language for the specified object. Read/write.
Length | Returns a Long value indicating the length of the specified text range, in characters. Read-only.
LinesCount | Returns the number of lines of text in the text range represented by the parent TextRange object. Read-only.
MajorityFont | Returns a Font object that represents the font name most in use in a text range.
MajorityParagraphFormat | Returns a ParagraphFormat object that represents the paragraph formatting applied to most of the paragraphs in a text range.
ParagraphFormat | Returns a ParagraphFormat object representing the paragraph formatting for the specified text range or text style.
ParagraphsCount | Returns the number of paragraphs of text in the text range represented by the parent TextRange object. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Script | Returns a PbFontScriptType constant that represents the font script for a text range. Read-only.
Start | Returns or sets a Long that represents the starting character position of a text range. Read/write.
Story | Returns a Story object that represents the story properties in a text range.
Text | Returns or sets a String that represents the text in a text range or WordArt shape. Read/write.
WordsCount | Returns the number of words in the text range represented by the parent TextRange object. Read-only.


HeaderFooter.IsHeader Property (Publisher)

 Copy code hover
[image]

HeaderFooter.IsHeader Property (Publisher)
Send feedback

True if the specified HeaderFooter object is a header, False if it is a footer. Read-only Boolean.

Syntax

expression .IsHeader

expression A variable that represents an HeaderFooter object.

Return Value

Boolean

Example

The following example creates a new collection and fills it with the headers and footer from each master page. The collection is then iterated and a test is made to determine whether the HeaderFooter object is a header or a footer, then appropriate text is written to the header or footer.

Copy code Copy code
Dim objHeadersFooters As Collection
Dim objMasterPage As page
Dim objHeadFoot As HeaderFooter

Set objHeadersFooters = New Collection
For Each objMasterPage In ActiveDocument.masterPages
 objHeadersFooters.Add objMasterPage.Header
 objHeadersFooters.Add objMasterPage.Footer
Next objMasterPage

For Each objHeadFoot In objHeadersFooters
 If objHeadFoot.IsHeader = True Then
 objHeadFoot.TextRange.Text = "Header Text"
 ElseIf objHeadFoot.IsHeader = False Then
 objHeadFoot.TextRange.Text = "Footer Text"
 End If
Next


Cell.Row Property (Publisher)

 Copy code hover
[image]

Cell.Row Property (Publisher)
Send feedback

Returns a Long that represents the row number containing the specified cell. Read-only.

Syntax

expression .Row

expression A variable that represents a Cell object.

Example

This example enters the fill for all even-numbered rows and clears the fill for all odd-numbered rows in the specified table. This example assumes the specified shape is a table and not another type of shape.

VBA Copy code Copy code
Sub FillCellsByRow()
 Dim shpTable As Shape
 Dim rowTable As Row
 Dim celTable As Cell

 Set shpTable = ActiveDocument.Pages(1).Shapes _
 .AddTable(NumRows:=5, NumColumns:=5, Left:=100, _
 Top:=100, Width:=100, Height:=12)
 For Each rowTable In shpTable.Table.Rows
 For Each celTable In rowTable.Cells
 If celTable.Row Mod 2 = 0 Then
 celTable.Fill.ForeColor.RGB = RGB _
 (Red:=180, Green:=180, Blue:=180)
 Else
 celTable.Fill.ForeColor.RGB = RGB _
 (Red:=255, Green:=255, Blue:=255)
 End If
 Next celTable
 Next rowTable

End Sub


Application.ColorSchemes Property (Publisher)

 Copy code hover
[image]

Application.ColorSchemes Property (Publisher)
See also Send feedback

Returns a ColorSchemes collection that represents the color schemes available.

Syntax

expression .ColorSchemes

expression A variable that represents a Application object.

Return Value

ColorSchemes

Example

The following example loops through the ColorSchemes collection and displays the name of each color scheme and the RGB value of the color for followed hyperlinks in each scheme.

Copy code Copy code
Dim cscLoop As ColorScheme
Dim cscAll As ColorSchemes

Set cscAll = Application.ColorSchemes

For Each cscLoop In cscAll
 With cscLoop
 Debug.Print "Color scheme: " & .Name _
 & " / Followed hyperlink color: " _
 & .Colors(ColorIndex:=pbSchemeColorFollowedHyperlink).RGB
 End With
Next cscLoop

See also

Concepts

Application Object

Other resources

Application Object Members


EmailMergeEnvelope.Parent Property (Publisher)

 Copy code hover
[image]

EmailMergeEnvelope.Parent Property (Publisher)
Send feedback

Returns the parent of the EmailMergeEnvelope object. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .Parent

expression A variable that represents an EmailMergeEnvelope object.

Return Value

Object


WizardProperty Members (Publisher)

 Copy code hover
[image]

WizardProperty Members (Publisher)
Send feedback

Represents a setting that is part of a specific publication design or a Design Gallery object's wizard.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
CurrentValueId | Returns or sets a Long indicating the value of a setting in the specified publication design or Design Gallery object's wizard. Read/write.
Enabled | True if a wizard property is enabled. Read-only Boolean.
ID | Returns a Long that represents the type of a shape, range of shapes, or property, type, or value of a wizard. Read-only.
Name | Returns a String value indicating the name of the specified object. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Values | Returns a WizardValues collection representing all the valid values for a wizard property.


Document.Selection Property (Publisher)

 Copy code hover
[image]

Document.Selection Property (Publisher)
Send feedback

Returns a Selection object that represents a selected range or the cursor.

Syntax

expression .Selection

expression A variable that represents a Document object.

Example

This example tests whether the current selection is text. If it is text, the selected text is then displayed in a message box.

Copy code Copy code
Sub Selectable()

 If Selection.Type = pbSelectionText Then MsgBox Selection.TextRange

End Sub


ScratchArea.Application Property (Publisher)

 Copy code hover
[image]

ScratchArea.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a ScratchArea object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Document.ColorScheme Property (Publisher)

 Copy code hover
[image]

Document.ColorScheme Property (Publisher)
Send feedback

Returns or sets the ColorScheme object that represents the scheme colors for the specified publication. Read/write.

Syntax

expression .ColorScheme

expression A variable that represents a Document object.

Return Value

ColorScheme

Example

This example displays the name of the current color scheme for the active publication.

Copy code Copy code
With ActiveDocument.ColorScheme
 MsgBox "The current color scheme is " & .Name & "."
End With

This example sets the color scheme of the active publication to "Alpine."

Copy code Copy code
ActiveDocument.ColorScheme _
 = Application.ColorSchemes("Alpine")


PbMailMergeDataSource Enumeration (Publisher)

 Copy code hover
[image]

PbMailMergeDataSource Enumeration (Publisher)
Send feedback

This enumeration is not implemented. Do not use.

Name | Value | Description
pbMergeInfoFromODSO | 5 | From ODSO
pbMergeInfoSubODSO | 6 | Sub ODSO


Document.DocumentDirection Property (Publisher)

 Copy code hover
[image]

Document.DocumentDirection Property (Publisher)
Send feedback

Returns or sets a PbDirectionType constant that indicates whether text in the document is read from left to right or from right to left. Read/write.

Syntax

expression .DocumentDirection

expression A variable that represents a Document object.

Return Value

PbDirectionType

Remarks

The DocumentDirection property value can be one of the PbDirectionType constants declared in the Microsoft Publisher type library.

The DocumentDirection property affects the way the document is read but not the flow of text in the document. For example, if the document has a binding edge and is printed on both sides of the page, the binding edge for a left-to-right document would be different from the binding edge of a right-to-left document.

To format the direction of text flow, use the DefaultTextFlowDirection property to specify the default text flow for the entire document, or use the Orientation property for an individual text frame to specify a text flow direction other than the default for the specified text frame only.

Example

This example sets the active publication to read from left to right.

VBA Copy code Copy code
Sub SetBiDiText()
 ActiveDocument.DocumentDirection = pbDirectionRightToLeft
End Sub


ParagraphFormat.ListIndent Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.ListIndent Property (Publisher)
Send feedback

Returns or sets a Single that represents the list indent value (in points) for the specified ParagraphFormat object. Read/write.

Syntax

expression .ListIndent

expression A variable that represents a ParagraphFormat object.

Return Value

Single

Example

This example sets the ListIndent property of a ParagraphFormat object to 0.25 inches. The InchesToPoints method is used to convert inches to points.

Copy code Copy code
Dim objParaForm As ParagraphFormat

Set objParaForm = ActiveDocument.Pages(1).Shapes(1) _
.TextFrame.TextRange.ParagraphFormat

With objParaForm
 .ListIndent = InchesToPoints(0.25)
End With


ColorsInUse Members (Publisher)

 Copy code hover
[image]

ColorsInUse Members (Publisher)
Send feedback

A collection of ColorFormat objects that represent the colors present in the specified publication.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Item | Returns an individual object from a specified collection. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Document.IsDataSourceConnected Property (Publisher)

 Copy code hover
[image]

Document.IsDataSourceConnected Property (Publisher)
Send feedback

True if the specified publication is connected to a data source. Read-only.

Syntax

expression .IsDataSourceConnected

expression A variable that represents an Document object.

Remarks

A publication must be connected to a valid data source to perform a mail merge or catalog merge.

Example

The following example tests whether the publication is connected to a data source and, if it is not, specifies and connects a data source to the publication.

Before running this example, you must replace PathToFile with a valid file path and TableName with a valid data source table name.

VBA Copy code Copy code
Dim strDataSource As String
Dim strDataSourceTable As String

 'Specify data source and table name

 strDataSource = "PathToFile"
 strDataSourceTable = "TableName"

 'Connect to a datasource
 If Not (ThisDocument.IsDataSourceConnected) Then
 ThisDocument.MailMerge.OpenDataSource strDataSource, , strDataSourceTable

 End If


PbPlacementType Enumeration (Publisher)

 Copy code hover
[image]

PbPlacementType Enumeration (Publisher)
Send feedback

Represents the placement of envelopes in the printer tray.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbPlacementCenter | 3 | Center
pbPlacementLeft | 1 | Left
pbPlacementRight | 2 | Right


CaptionStyle.Parent Property (Publisher)

 Copy code hover
[image]

CaptionStyle.Parent Property (Publisher)
Send feedback

Returns the parent of the CaptionStyle object. Read-only.

Syntax

expression .Parent

expression A variable that represents a CaptionStyle object.


PictureFormat.CropTop Property (Publisher)

 Copy code hover
[image]

PictureFormat.CropTop Property (Publisher)
Send feedback

Returns or sets a Variant indicating the amount by which the top edge of a picture or OLE object is cropped. Read/write.

Syntax

expression .CropTop

expression A variable that represents a PictureFormat object.

Return Value

Variant

Remarks

Numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

Negative values crop the top edge away from the center of the frame and positive values crop toward the bottom edge of the frame.

The valid range of crop values depends on the frame's position and size. For an unrotated frame, the lowest negative value allowed is the distance between the top edge of frame and the top edge of the scratch area. The highest positive value allowed is the current frame height.

Cropping is calculated relative to the original size of the picture. For example, if you insert a picture that is originally 100 points high, rescale it so that it is 200 points high, and then set the CropTop property to 50, 100 points (not 50) will be cropped off the top of your picture.

Use the CropLeft, CropRight, and CropBottom properties to crop other edges of a picture or OLE object.

Example

This example crops 20 points off the top of the third shape in the active publication. For the example to work, the shape must be either a picture or an OLE object.

Copy code Copy code
ActiveDocument.Pages(1).Shapes(3).PictureFormat _
 .CropTop = 20

This example crops the percentage specified by the user off the top of the selected shape, regardless of whether the shape has been scaled. For the example to work, the selected shape must be either a picture or an OLE object.

Copy code Copy code
Dim sngPercent As Single
Dim shpCrop As Shape
Dim sngPoints As Single
Dim sngHeight As Single

sngPercent = InputBox("What percentage do you " & _
 "want to crop off the top of this picture?")

Set shpCrop = Selection.ShapeRange(1)
With shpCrop.Duplicate
 .ScaleHeight Factor:=1, _
 RelativeToOriginalSize:=True
 sngHeight = .Height
 .Delete
End With

sngPoints = sngHeight * sngPercent / 100

shpCrop.PictureFormat.CropTop = sngPoints


PageSetup.PageSize Property (Publisher)

 Copy code hover
[image]

PageSetup.PageSize Property (Publisher)
Send feedback

Gets or sets the blank page size for the current publication. Read/write.

Version Information

Version Added: Publisher 2007

Syntax

expression .PageSize

expression A variable that represents a PageSetup object.

Return Value

PageSize

Remarks

The blank page size represented by the PageSize object returned or set by the PageSize property corresponds to one of the icons displayed under Blank Page Sizes in the Page Setup dialog box in the Microsoft Publisher user interface.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to set the blank page size for the current publication. The example sets the blank page size to "Index Card," which is the blank page size at index number 130 in the AvailablePageSizes collection. See the AvailablePageSizes property topic for an example of how to create a text file that contains the list of all page sizes available in the current publication and their corresponding index numbers.

VBA Copy code Copy code
Public Sub PageSize_Example()

 ThisDocument.PageSetup.PageSize = ThisDocument.PageSetup.AvailablePageSizes.Item(130)

End Sub


FillFormat.GradientColorType Property (Publisher)

 Copy code hover
[image]

FillFormat.GradientColorType Property (Publisher)
Send feedback

Returns an MsoGradientColorType constant indicating the gradient color type for the specified fill. Read-only.

Syntax

expression .GradientColorType

expression A variable that represents a FillFormat object.

Return Value

MsoGradientColorType

Remarks

Use the OneColorGradient , PresetGradient , or TwoColorGradient method to set the gradient type for the fill.

The GradientColorType property value can be one of the MsoGradientColorType constants declared in the Microsoft Office type library.

Example

This example changes the fill for all shapes on the first page of the active publication that have a two-color gradient fill to a preset gradient fill.

VBA Copy code Copy code
Dim shpLoop As Shape

' Loop through collection of shapes.
For Each shpLoop In ActiveDocument.Pages(1).Shapes
 With shpLoop.Fill
 ' Test for two-color gradient.
 If .GradientColorType = msoGradientTwoColors Then
 ' Apply a preset gradient.
 .PresetGradient Style:=msoGradientHorizontal, _
 Variant:=1, PresetGradientType:=msoGradientBrass
 End If
 End With
Next shpLoop


Options.ShowScreenTipsOnObjects Property (Publisher)

 Copy code hover
[image]

Options.ShowScreenTipsOnObjects Property (Publisher)
Send feedback

True for Microsoft Publisher to display ScreenTips when the mouse pointer hovers over a text box, shape or other object. Read/write Boolean.

Syntax

expression .ShowScreenTipsOnObjects

expression A variable that represents a Options object.

Return Value

Boolean

Example

This example disables displaying ScreenTips on objects.

VBA Copy code Copy code
Sub DisableScreenTips()
 Options.ShowScreenTipsOnObjects = False
End Sub


WrapFormat.Side Property (Publisher)

 Copy code hover
[image]

WrapFormat.Side Property (Publisher)
Send feedback

Returns or sets a PbWrapSideType constant that indicates whether text should wrap around a shape. Read/write.

Syntax

expression .Side

expression A variable that represents a WrapFormat object.

Return Value

PbWrapSideType

Remarks

The Side property value can be one of the PbWrapSideType constants declared in the Microsoft Publisher type library.

Example

This example adds an oval to the first page of the active publication and specifies that text wrap around both the left and right sides of the oval.

VBA Copy code Copy code
Sub SetTextWrapFormatProperties()
 With ActiveDocument.Pages(1).Shapes.AddShape(Type:=msoShapeOval, _
 Left:=36, Top:=36, Width:=100, Height:=35)
 With .TextWrap
 .Type = pbWrapTypeSquare
 .Side = pbWrapSideBoth
 End With
 End With
End Sub


Story Members (Publisher)

 Copy code hover
[image]

Story Members (Publisher)
Send feedback

Represents the text in an unlinked text frame, text flowing between linked text frames, or text in a table cell. The Story object is a member of the TextFrame and TextRange objects and the Stories collection.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
HasTable | Returns msoTrue if the shape represents a TableFrame object or msoFalse if the shape represents any other object type. Read-only.
HasTextFrame | Indicates whether the specified shape has a TextFrame object associated with it. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Table | Returns a Table object that represents a table in Microsoft Publisher.
TextFrame | Returns a TextFrame object that represents the text in a shape and the properties that control the margins and orientation of the text.
TextRange | Returns a TextRange object that represents the text that is attached to a shape and properties and methods for manipulating the text.
Type | Specifies the type of story. Read-only.


Document.SaveAs Method (Publisher)

 Copy code hover
[image]

Document.SaveAs Method (Publisher)
Send feedback

Saves the specified publication with a new name or format.

Syntax

expression .SaveAs(Filename, Format, AddToRecentFiles)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Optional | Variant | The name for the publication. The default is the current folder and file name. If the publication has never been saved, the default name is used, for example, Publication1.pub. If a publication with the specified file name already exists, the publication is overwritten without the user being prompted first.
Format | Optional | PbFileFormat | The format in which the publication is saved.
AddToRecentFiles | Optional | Boolean | True to add the publication to the list of recently used files on the File menu. Default is True.

Remarks

The Format parameter can be one of the PbFileFormat constants declared in the Microsoft Publisher type library and shown in the following table. The default is pbFilePublication.

pbFileHTMLFiltered

pbFilePublication

pbFilePublicationHTML

pbFilePublisher2000

pbFilePublisher98

pbFileRTF

pbFileWebArchive

If there is insufficient memory or disk space to save the file, an error occurs.

Calling the SaveAs method always performs saves in the foreground regardless of whether background saves are enabled.

Example

This example saves the active publication as a Microsoft Publisher 2000 file.

Copy code Copy code
ActiveDocument.SaveAs FileName:="ReportPub2000.pub", Format:=pbFilePublisher2000

This example saves the active publication as Test.rtf in Rich Text Format (RTF).

Copy code Copy code
ActiveDocument.SaveAs FileName:="Test.rtf", Format:=pbFileRTF

This example saves the active Web publication as a set of filtered HTML pages and supporting files. Note that the .htm extension is automatically added to the value of the Filename parameter if the value of the Format parameter is pbFileHTMLFiltered.

Copy code Copy code
With ActiveDocument
 .SaveAs Filename:="CompanyContacts", Format:=pbFileHTMLFiltered
End With


TextRange.ParagraphsCount Property (Publisher)

 Copy code hover
[image]

TextRange.ParagraphsCount Property (Publisher)
Send feedback

Returns the number of paragraphs of text in the text range represented by the parent TextRange object. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .ParagraphsCount

expression A variable that represents a TextRange object.

Return Value

Long


LineFormat.Pattern Property (Publisher)

 Copy code hover
[image]

LineFormat.Pattern Property (Publisher)
Send feedback

Returns or sets an MsoPatternType constant that represents the pattern applied to the specified fill or line.

Syntax

expression .Pattern

expression A variable that represents a LineFormat object.

Remarks

The Pattern property value can be one of the MsoPatternType constants declared in the Microsoft Office type library.

Example

This example sets the pattern for the specified shape if the shape currently doesn't have a fill pattern. This example assumes that at least one shape exists on the first page of the active publication.

VBA Copy code Copy code
Sub ChangeFillPattern()
 With ActiveDocument.Pages(1).Shapes(1).Fill
 If .Pattern < msoPattern10Percent Then
 .Patterned Pattern:=msoPattern25Percent
 End If
 End With
End Sub


BorderArtFormat Object (Publisher)

 Copy code hover
[image]

BorderArtFormat Object (Publisher)
See also Send feedback

Represents the formatting of the BorderArt applied to the specified shape.

Remarks

BorderArt are picture borders that can be applied to text boxes, picture frames, or rectangles.

Example

Use the BorderArt property of a shape to return a BorderArtFormat object.

The following example returns the BorderArt of the first shape on the first page of the active publication, and displays the name of the BorderArt in a message box.

Copy code Copy code
Dim bdaTemp As BorderArtFormat

Set bdaTemp = ActiveDocument.Pages(1).Shapes(1).BorderArt
MsgBox "BorderArt name is: " &bdaTemp.Name

Use the Set method to specify which type of BorderArt you want applied to a picture. The following example tests for the existence of BorderArt on each shape for each page of the active document. Any BorderArt found is set to the same type.

Copy code Copy code
Sub SetBorderArt()
Dim anyPage As Page
Dim anyShape As Shape
Dim strBorderArtName As String

strBorderArtName = Document.BorderArts(1).Name

For Each anyPage in ActiveDocument.Pages
For Each anyShape in anyPage.Shapes
With anyShape.BorderArt
If .Exists = True Then
.Set(strBorderArtName)
End If
End With
Next anyShape
Next anyPage
End Sub

You can also use the Name property to specify which type of BorderArt you want applied to a picture. The following example sets all the BorderArt in a document to the same type using the Name property.

Copy code Copy code
Sub SetBorderArtByName()
Dim anyPage As Page
Dim anyShape As Shape
Dim strBorderArtName As String

strBorderArtName = Document.BorderArts(1).Name

For Each anyPage in ActiveDocument.Pages
For Each anyShape in anyPage.Shapes
With anyShape.BorderArt
If .Exists = True Then
.Name = strBorderArtName
End If
End With
Next anyShape
Next anyPage
End Sub
Note Note

Because Name is the default property of both the BorderArt and BorderArtFormat objects, you do not need to state it explicitly when setting the BorderArt type. The statement

Shape.BorderArtFormat = Document.BorderArts(1)

is equivalent to

Shape.BorderArtFormat.Name = Document.BorderArts(1).Name

Use the Delete method to remove BorderArt from a picture. The following example tests for the existence of border art on each shape for each page of the active document. If border art exists, it is deleted.

Copy code Copy code
Sub DeleteBorderArt()
Dim anyPage As Page
Dim anyShape As Shape

For Each anyPage in ActiveDocument.Pages
For Each anyShape in anyPage.Shapes
With anyShape.BorderArt
If .Exists = True Then
.Delete
End If
End With
Next anyShape
Next anyPage
End Sub

See also

Other resources

BorderArtFormat Object Members


Tags Members (Publisher)

 Copy code hover
[image]

Tags Members (Publisher)
Send feedback

A collection of Tag objects that represents tags or custom properties applied to a shape, shape range, page, or publication.

Methods

Name | Description
Add | Adds a new Tag object to the specified Tags object and returns the new Tag object.
Item | Returns an individual object in a specified collection.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


MailMergeFilterCriterion.Comparison Property (Publisher)

 Copy code hover
[image]

MailMergeFilterCriterion.Comparison Property (Publisher)
Send feedback

Returns or sets an MsoFilterComparison constant that represents how to compare the Column and CompareTo properties. Read/write.

Syntax

expression .Comparison

expression A variable that represents a MailMergeFilterCriterion object.

Return Value

MsoFilterComparison

Remarks

The Comparison property value can be one of the MsoFilterComparison constants declared in the Microsoft Office type library.

Example

The following example changes an existing filter to remove from the mail merge all records that do not have a Region field equal to "WA". This example assumes that a mail merge data source is attached to the active publication.

Copy code Copy code
Sub SetQueryCriterion()
 Dim intItem As Integer
 With ActiveDocument.MailMerge.DataSource.Filters
 For intItem = 1 To .Count
 With .Item(intItem)
 If .Column = "Region" Then
 .Comparison = msoFilterComparisonNotEqual
 .CompareTo = "WA"
 If .Conjunction = "Or" Then .Conjunction = "And"
 End If
 End With
 Next intItem
 End With
End Sub


Application.PointsToTwips Method (Publisher)

 Copy code hover
[image]

Application.PointsToTwips Method (Publisher)
See also Send feedback

Converts a measurement from points to twips (20 twips = 1 point). Returns the converted measurement as a Single.

Syntax

expression .PointsToTwips(Value)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Value | Required | Single | The point value to be converted to twips.

Return Value

Single

Remarks

Use the TwipsToPoints method to convert measurements in twips to points.

Example

This example converts measurements in points entered by the user to measurements in centimeters.

Copy code Copy code
Dim strInput As String
Dim strOutput As String

Do While True
 ' Get input from user.
 strInput = InputBox( _
 Prompt:="Enter measurement in points (0 to cancel): ", _
 Default:="0")

 ' Exit the loop if user enters zero.
 If Val(strInput) = 0 Then Exit Do

 ' Evaluate and display result.
 strOutput = Trim(strInput) & " points = " _
 & Format(Application _
 .PointsToTwips(Value:=Val(strInput)), _
 "0.00") & " twips"

 MsgBox strOutput
Loop

See also

Concepts

Application Object

Other resources

Application Object Members


Selection.Parent Property (Publisher)

 Copy code hover
[image]

Selection.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a Selection object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


TextRange.BoundWidth Property (Publisher)

 Copy code hover
[image]

TextRange.BoundWidth Property (Publisher)
Send feedback

Returns a Single indicating the width, in points, of the bounding box for the specified text range. Read-only.

Syntax

expression .BoundWidth

expression A variable that represents a TextRange object.

Return Value

Single

Example

The following example displays the position, width, and height of the bounding box surrounding the text in the first shape on page one of the active publication.

Copy code Copy code
Dim rngText As TextRange
Dim strMessage As String

Set rngText = ActiveDocument.Pages(1) _
 .Shapes(1).TextFrame.TextRange

With rngText
 strMessage = "Text frame information" & vbCrLf _
 & " Distance from left edge of page: " _
 & .BoundLeft & " points" & vbCrLf _
 & " Distance from top edge of page: " _
 & .BoundTop & " points" & vbCrLf _
 & " Width: " & .BoundWidth & " points" & vbCrLf _
 & " Height: " & .BoundHeight & " points"
End With

MsgBox strMessage


TextStyles Methods (Publisher)

 Copy code hover
[image]

TextStyles Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Add | Adds a new TextStyle object to the specified TextStyles object and returns the new TextStyle object.
Item | Returns an individual object in a specified collection.


Field.Code Property (Publisher)

 Copy code hover
[image]

Field.Code Property (Publisher)
Send feedback

Returns a String that represents the text displayed when the page view is set to show field codes. Read-only.

Syntax

expression .Code

expression A variable that represents a Field object.

Return Value

String

Example

This example loops through all the fields in the active publication, and then displays a message as to whether the string "www" was found in the code of any of the fields.

Copy code Copy code
Sub FindWWWHyperlinks()
 Dim intItem As Integer
 Dim intField As Integer
 With ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange.Fields
 Do
 intItem = intItem + 1
 If InStr(1, .Item(intItem).Code, "www") > 0 Then
 intField = intField + 1
 End If
 Loop Until intItem = .Count
 End With

 If intField > 0 Then
 MsgBox "You have " & intField & " World Wide Web " & _
 "hyperlinks in your publication."
 Else
 MsgBox "You have no hyperlink fields in your publication."
 End If
End Sub


Story.TextFrame Property (Publisher)

 Copy code hover
[image]

Story.TextFrame Property (Publisher)
Send feedback

Returns a TextFrame object that represents the text in a shape and the properties that control the margins and orientation of the text.

Syntax

expression .TextFrame

expression A variable that represents a Story object.

Example

The following example adds text to the text frame of shape one in the active publication, and then formats the new text. This example assumes there is at least one shape on the first page of the active publication.

Copy code Copy code
Sub AddTextToTextFrame()
 With ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange
 .Text = "My Text"
 With .Font
 .Bold = msoTrue
 .Size = 25
 .Name = "Arial"
 End With
 End With
End Sub


TabStops.ClearAll Method (Publisher)

 Copy code hover
[image]

TabStops.ClearAll Method (Publisher)
Send feedback

Clears all the custom tab stops from the specified paragraphs.

Syntax

expression .ClearAll

expression A variable that represents a TabStops object.

Remarks

To clear an individual tab stop, use the Clear method of the TabStop object. The ClearAll method doesn't clear the default tab stops. To manipulate the default tab stops, use the DefaultTabStop property for the document.

Example

This example clears all the custom tab stops in the first shape on the first page of the active publication. This example assumes that the specified shape is a text frame and not another type of shape.

Copy code Copy code
Sub ClearAllTabStops()
 ActiveDocument.Pages(1).Shapes(1).TextFrame _
 .TextRange.ParagraphFormat.Tabs.ClearAll
End Sub


LineFormat.GradientColorType Property (Publisher)

 Copy code hover
[image]

LineFormat.GradientColorType Property (Publisher)
See also Send feedback

Returns the gradient color type for the specified line. Read-only.

Version Information

Version Added: Publisher 2013

Syntax

expression .GradientColorType

expression A variable that represents a LineFormat object.

Return value

MsoGradientColorType

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


Application.WindowPageChange Event (Publisher)

 Copy code hover
[image]

Application.WindowPageChange Event (Publisher)
See also Send feedback

Occurs when switching the view from one page to another page in a publication.

Syntax

expression .WindowPageChange(Vw, )

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Vw | Required | View | The new view that includes the page to which the view has been switched.

Example

This example changes the view to display the whole page when switching to a new page in a publication. For this example to work, you must place the WithEvents declaration in the General Declarations section of a class module and run the InitializeEvents routine.

Copy code Copy code
Private WithEvents PubApp As Publisher.Application

Sub InitializeEvents()
 Set PubApp = Publisher.Application
End Sub

Private Sub PubApp_WindowPageChange(ByVal Vw As View)
 Vw.Zoom = pbZoomWholePage
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Shape.Type Property (Publisher)

 Copy code hover
[image]

Shape.Type Property (Publisher)
Send feedback

Specifies the shape type. Read-only.

Syntax

expression .Type

expression A variable that represents a Shape object.

Remarks

The Type property value can be one of the PbShapeType constants declared in the Microsoft Publisher type library.

Example

This example formats the callout type of the specified shape if the shape is a callout. This example assumes there is at least one shape on the first page of the active publication.

VBA Copy code Copy code
Sub SetCalloutType()
 With ActiveDocument.Pages(1).Shapes(1)
 If .Type = pbCallout Then
 With .Callout
 .Border = msoTrue
 .Type = msoCalloutThree
 End With
 End If
 End With
End Sub


PageBackground.Fill Property (Publisher)

 Copy code hover
[image]

PageBackground.Fill Property (Publisher)
Send feedback

Returns a FillFormat object representing the fill for the specified shape or table cell.

Syntax

expression .Fill

expression A variable that represents a PageBackground object.

Example

This example creates a new AutoShape object and fills the shape with green.

VBA Copy code Copy code
Sub NewShapeItem()

 Dim shpHeart As Shape

 Set shpHeart = ThisDocument.MasterPages.Item(1).Shapes _
 .AddShape(Type:=msoShapeHeart, Left:=40, Top:=80, _
 Width:=50, Height:=50)
 shpHeart.Fill.ForeColor.RGB = RGB(Red:=0, Green:=255, Blue:=0)

End Sub


Document.RemovePersonalInformation Property (Publisher)

 Copy code hover
[image]

Document.RemovePersonalInformation Property (Publisher)
Send feedback

Returns or sets a Boolean that represents whether to save personal information when the file is saved. Read/write.

Syntax

expression .RemovePersonalInformation

expression A variable that represents a Document object.

Return Value

Boolean

Remarks

The information removed from the document is the Author, Manager, Company, and the GUID of the computer on which the document was created.

The default setting for this property is False.

Example

This example removes the personal information from the active document.

VBA Copy code Copy code
ActiveDocument.RemovePersonalInformation = True


Shape.IsGroupMember Property (Publisher)

 Copy code hover
[image]

Shape.IsGroupMember Property (Publisher)
Send feedback

Returns True if the specified shape is a member of a group, False otherwise. Read-only Boolean.

Syntax

expression .IsGroupMember

expression A variable that represents an Shape object.

Return Value

Boolean

Remarks

The object returned by the ParentGroupShape property can be used to determine the parent shape for the group.

Example

The following statement can be used to return a True value if the first shape of the active publication is a group member.

Copy code Copy code
blnGrouped = Application.ActiveDocument.MasterPages _
 .Item.Shapes(1).IsGroupMember


ShapeRange.GetTop Method (Publisher)

 Copy code hover
[image]

ShapeRange.GetTop Method (Publisher)
Send feedback

Returns the distance of the shape's or shape range's top edge from the top edge of the leftmost page in the current view as a Single in the specified units.

Syntax

expression .GetTop(Unit)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Required | PbUnitType | The units in which to return the distance.

Return Value

Single

Remarks

The Unit parameter can be one of the PbUnitType constants declared in the Microsoft Publisher type library.

Use the GetLeft method to return the distance of a shape's or shape range's left edge from the left edge of the leftmost page in the current view.

Example

The following example displays the distances from the left and top edges of the leftmost page to the left and top edges of shape range consisting of all the shapes on the first page. The distances are expressed in inches (to the nearest hundredth).

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes.Range
 MsgBox "Distance from left: " _
 & Format(.GetLeft(Unit:=pbUnitInch), "0.00") _
 & " in" & vbCr _
 & "Distance from top: " _
 & Format(.GetTop(Unit:=pbUnitInch), "0.00") _
 & " in"
End With


Shapes.AddCallout Method (Publisher)

 Copy code hover
[image]

Shapes.AddCallout Method (Publisher)
Send feedback

Adds a new Shape object representing a borderless line callout to the specified Shapes collection.

Syntax

expression .AddCallout(Type, Left, Top, Width, Height)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | MsoCalloutType | The type of callout line.
Left | Required | Variant | The position of the left edge of the shape representing the line callout.
Top | Required | Variant | The position of the top edge of the shape representing the line callout.
Width | Required | Variant | The width of the shape representing the line callout.
Height | Required | Variant | The height of the shape representing the line callout.

Return Value

Shape

Remarks

For the Left, Top, Width, and Height arguments, numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

The Type parameter can be one of these MsoCalloutType constants.

msoCalloutOne | A horizontal or vertical single-segment callout line.
msoCalloutTwo | A freely-rotating single-segment callout line.
msoCalloutThree | A two-segment callout line.
msoCalloutFour | A three-segment callout line.

Example

The following example adds a new freely-rotating callout line to the first page of the active publication.

VBA Copy code Copy code
Dim shpCallout As Shape

Set shpCallout = ActiveDocument.Pages(1).Shapes.AddCallout _
 (Type:=msoCalloutTwo, _
 Left:=144, Top:=216, _
 Width:=36, Height:=72)


CaptionStyle.Name Property (Publisher)

 Copy code hover
[image]

CaptionStyle.Name Property (Publisher)
Send feedback

A string that represents the name of the caption style. Read-only.

Syntax

expression .Name

expression A variable that represents a CaptionStyle object.


Section Properties (Publisher)

 Copy code hover
[image]

Section Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
ContinueNumbersFromPreviousSection | True if the specified section continues the numbering from the prvious section. Read/write Boolean.
PageNumberFormat | Sets or returns a PbPageNumberFormat constant that reperesents the formatting of the page numbering. Read/write.
PageNumberStart | Sets or returns the page number that the specified section starts with. Read/write Long.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
ShowHeaderFooterOnFirstPage | True if the header and footer of the specified section will be visible. Read/write Boolean.
StartPageIndex | Returns the page number of the page that the specified Section object begins on. Read-only.


ParagraphFormat.RightIndent Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.RightIndent Property (Publisher)
Send feedback

Returns or sets a Variant that represents the right indent (in points) for the specified paragraphs. Read/write.

Syntax

expression .RightIndent

expression A variable that represents a ParagraphFormat object.

Return Value

Variant

Example

This example sets the right indent for all paragraphs in the active document to one inch from the right margin. The InchesToPoints method is used to convert inches to points. This example assumes that there is at least one shape on the first page of the active publication.

VBA Copy code Copy code
Sub SetRightIndent()
 ActiveDocument.Pages(1).Shapes(1).TextFrame _
 .TextRange.Paragraphs(1).ParagraphFormat _
 .RightIndent = InchesToPoints(1)
End Sub


Story.HasTable Property (Publisher)

 Copy code hover
[image]

Story.HasTable Property (Publisher)
Send feedback

Returns msoTrue if the shape represents a TableFrame object or msoFalse if the shape represents any other object type. Read-only.

Syntax

expression .HasTable

expression A variable that represents a Story object.

Example

This example checks the currently selected shape to see if it is a table. If it is, the code sets the width of column one to one inch (72 points).

VBA Copy code Copy code
Sub IsTable()

 With Application.Selection.ShapeRange
 If .HasTable = msoTrue Then
 .Table.Columns(1).Width = 72
 End If
 End With

End Sub


Tags Methods (Publisher)

 Copy code hover
[image]

Tags Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Add | Adds a new Tag object to the specified Tags object and returns the new Tag object.
Item | Returns an individual object in a specified collection.


RulerGuides Members (Publisher)

 Copy code hover
[image]

RulerGuides Members (Publisher)
Send feedback

A collection of RulerGuide objects that represents a gridline used to align objects on a page.

Methods

Name | Description
Add | Adds a new ruler guide to the specified RulerGuides collection.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Item | Returns an individual object from a specified collection. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Selection Members (Publisher)

 Copy code hover
[image]

Selection Members (Publisher)
Send feedback

Represents the current selection in a window or pane. A selection represents either a selected (or highlighted) area in the publication, or it represents the cursor if nothing in the publication is selected. There can only be one Selection object per publication window pane, and only one Selection object in the entire application can be active.

Methods

Name | Description
Unselect | Cancels the current selection.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
ChildShapeRange | Returns a ShapeRange object representing the child shapes of a selection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
ShapeRange | Returns a ShapeRange collection that represents all the Shape objects in the specified range or selection. The shape range can contain drawings, shapes, pictures, OLE objects, ActiveX controls, text objects, and callouts.
TableCellRange | Returns a CellRange object that represents the cells in a table selection.
TextRange | Returns a TextRange object that represents the text that is attached to a shape and properties and methods for manipulating the text.
Type | Returns a PbSelectionType constant that represents the selection type. Read-only.


WebNavigationBarSet.ChangeOrientation Method (Publisher)

 Copy code hover
[image]

WebNavigationBarSet.ChangeOrientation Method (Publisher)
Send feedback

Sets a PbNavBarOrientation constant that represents the alignment of the navigation bar; vertical or horizontal.

Syntax

expression .ChangeOrientation(Orientation)

expression A variable that represents a WebNavigationBarSet object.

Parameters

Name | Required/Optional | Data Type | Description
Orientation | Required | PbNavBarOrientation

Remarks

The Orientation parameter can be one of the following PbNavBarOrientation constants declared in the Microsoft Publisher type library.

pbNavBarOrientHorizontal

pbNavBarOrientVertical

Example

The following example sets an object variable to the first Web navigation bar set in the active document, adds it to every page, changes the orientation to horizontal, sets the horizontal alignment to center, and then sets the horizontal button count to 4.

VBA Copy code Copy code
Dim objWebNav As WebNavigationBarSet
Set objWebNav = ActiveDocument.WebNavigationBarSets(1)
With objWebNav
 .AddToEveryPage Left:=10, Top:=10
 .ChangeOrientation pbNavBarOrientHorizontal
 .HorizontalAlignment = pbnbAlignCenter
 .HorizontalButtonCount = 4
End With


PageSizes.Application Property (Publisher)

 Copy code hover
[image]

PageSizes.Application Property (Publisher)
Send feedback

Returns an Application object that represents the creator of the parent PageSizes collection. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .Application

expression A variable that represents a PageSizes collection.

Return Value

Application


AdvancedPrintOptions.Parent Property (Publisher)

 Copy code hover
[image]

AdvancedPrintOptions.Parent Property (Publisher)
See also Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents an AdvancedPrintOptions object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub

See also

Concepts

AdvancedPrintOptions Object

Other resources

AdvancedPrintOptions Object Members


Plate Properties (Publisher)

 Copy code hover
[image]

Plate Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Color | Returns a ColorFormat object representing the color information for the specified object.
Index | Returns a Long that represents the position of a particular item in a specified collection. .
InkName | Returns a PbInkName constant that represents the name of the ink to be printed using this plate. Read-only.
InUse | Returns True if the specified ink (represented by the plate) is used in the publication. Read-only Boolean.
Luminance | Returns or sets a Long indicating a calculated luminance value for the specified plate; used for spot-color trapping. Valid values are from 0 to 100. Read/write.
Name | Returns a String value indicating the name of the specified object. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


WebNavigationBarSets Members (Publisher)

 Copy code hover
[image]

WebNavigationBarSets Members (Publisher)
Send feedback

A collection of all the WebNavigationBarSet objects in the current document. Each WebNavigationBarSet represents a Web navigation bar set consisting of hyperlinks.

Methods

Name | Description
AddSet | Adds a new WebNavigationBarSet object representing a Web navigation bar set to the specified WebNavigationBarSets collection. .
Item | Returns an individual object in a specified collection.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Documents Members (Publisher)

 Copy code hover
[image]

Documents Members (Publisher)
Send feedback

Represents all open publications. The Documents collection contains all Document objects that are open in Microsoft Publisher.

Methods

Name | Description
Add | Adds a new Document object that represents a new publication to the Documents collection.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Item | Returns an individual object from a specified collection. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


TextFrame.MarginRight Property (Publisher)

 Copy code hover
[image]

TextFrame.MarginRight Property (Publisher)
Send feedback

Returns or sets a Variant that represents the amount of space (in points) between the text and the right edge of a cell, text frame, or page. Read/write.

Syntax

expression .MarginRight

expression A variable that represents a TextFrame object.

Example

This example sets the margins of the active publication to two inches.

Copy code Copy code
Sub SetPageMargins()

 With ActiveDocument.LayoutGuides
 .MarginTop = Application.InchesToPoints(Value:=2)
 .MarginBottom = Application.InchesToPoints(Value:=2)
 .MarginLeft = Application.InchesToPoints(Value:=2)
 .MarginRight = Application.InchesToPoints(Value:=2)
 End With

End Sub


PbFixedFormatIntent Enumeration (Publisher)

 Copy code hover
[image]

PbFixedFormatIntent Enumeration (Publisher)
Send feedback

Constants passed to the ExportAsFixedFormat method that specify how the user intends to share the resulting file.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbIntentCommercial | 4 | Submit the publication to a commercial press.
pbIntentMinimum | 1 | Squeeze the publication to the smallest file size. This satisfies the on-screen viewing scenario where the publication is viewed on a computer monitor.
pbIntentPrinting | 3 | Print the publication on a desktop printer or at a copy store, such as Kinko's.
pbIntentStandard | 2 | Distribute the publication as an e-mail message or from a Web site. Note that the user does not know how the publication will be viewed: on-screen or printed from a desktop printer. Both the desktop printing scenario and the on-screen viewing scenario must be met by this intent.


BuildingBlock Properties (Publisher)

 Copy code hover
[image]

BuildingBlock Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Category | Gets or sets a string that represents the category for the building block. Read/Write.
Description | Gets or sets a string that represents the description of the building block. Read/write.
Gallery | A PbBuildingBlockGallery constant that indicates the building block gallery on the ribbon that contains the specified building block, if ShowInGallery is True. Read/write.
Keywords | A string that represents the search keywords associated with the building block. Read/write.
Name | A string that represents the unique name of the building block. Read/write.
ShowInGallery | A Boolean value that specifies whether the building block should be displayed in the ribbon gallery it belongs to. Read/write.
Type | A PbBuildingBlockType Enumeration (Publisher) value that represents the type of the building block. Read-only.


WebListBoxItems.Item Method (Publisher)

 Copy code hover
[image]

WebListBoxItems.Item Method (Publisher)
Send feedback

Returns a String corresponding to the value of a hidden field in a Web form or a list item in a Web list box control.

Syntax

expression .Item(Index)

expression A variable that represents a WebListBoxItems object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The number or name of the field or list box item to return.

Return Value

String


Application.PointsToLines Method (Publisher)

 Copy code hover
[image]

Application.PointsToLines Method (Publisher)
See also Send feedback

Converts a measurement from points to lines (1 line = 12 points). Returns the converted measurement as a Single.

Syntax

expression .PointsToLines(Value)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Value | Required | Single | The point value to be converted to lines.

Return Value

Single

Remarks

This method assumes a measurement in 12-point lines — the actual size of any text in the publication has no effect on the conversion factor.

Use the LinesToPoints method to convert measurements in lines to points.

Example

This example converts measurements in lines to measurements in points, demonstrating that the font size in the current selection has no bearing on the conversion factor. Some text must be selected in the active publication for this example to work.

Copy code Copy code
Dim strOutput As String

' Set text size to 10 points.
Selection.TextRange.Font.Size = 10

' Display result for 12 points.
strOutput = "12 points = " _
 & Format(Application _
 .PointsToLines(Value:=12), _
 "0.00") & " lines"

See also

Concepts

Application Object

Other resources

Application Object Members


PictureFormat.Brightness Property (Publisher)

 Copy code hover
[image]

PictureFormat.Brightness Property (Publisher)
Send feedback

Returns or sets a Single indicating the brightness of the specified picture or OLE object. The value for this property must be a number from 0.0 (dimmest) to 1.0 (brightest). Read/write.

Syntax

expression .Brightness

expression A variable that represents a PictureFormat object.

Return Value

Single

Remarks

Use the IncrementBrightness method to incrementally adjust the brightness from its current level.

Example

This example sets the brightness for the first shape in the active publication. The shape must be either a picture or an OLE object.

Copy code Copy code
ActiveDocument.Pages(1).Shapes(1).PictureFormat _
 .Brightness = 0.3


FreeformBuilder Properties (Publisher)

 Copy code hover
[image]

FreeformBuilder Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


ShapeRange.MoveIntoTextFlow Method (Publisher)

 Copy code hover
[image]

ShapeRange.MoveIntoTextFlow Method (Publisher)
Send feedback

Moves a given shape into the text flow defined by TextRange Object. The shape will always be inserted inline at the beginning of the text flow.

Syntax

expression .MoveIntoTextFlow(Range)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | TextRange | The range of text before which the given shape is inserted.

Remarks

The MoveIntoTextFlow method will fail if the shape to be moved is already inline or if it is not a valid inline shape type. Invalid inline shape types include:

  • Inline shapes

  • Grouped shapes

  • HTML fragments

  • Smart objects

  • Chained text boxes

Example

The following example checks if the second shape on the second page of the publication is inline, and if it is not, inserts it inline at the beginning of the text flow of the given text range.

Copy code Copy code
Dim theShape As Shape
Dim theRange As TextRange

Set theRange = ActiveDocument.Pages(2).Shapes(1).TextFrame.TextRange
Set theShape = ActiveDocument.Pages(2).Shapes(2)

If Not theShape.IsInline = msoTrue Then
 theShape.MoveIntoTextFlow Range:=theRange
End If


DropCap Methods (Publisher)

 Copy code hover
[image]

DropCap Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
ApplyCustomDropCap | Applies custom formatting to the first letters of paragraphs in a text frame.
Clear | Removes the dropped capital letter formatting.


Rows Members (Publisher)

 Copy code hover
[image]

Rows Members (Publisher)
Send feedback

A collection of Row objects that represent the rows in a table.

Methods

Name | Description
Add | Adds a new Row object to the specified Rows collection and returns the new Row object.
Item | Returns an individual object in a specified collection.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


PbParagraphAlignmentType Enumeration (Publisher)

 Copy code hover
[image]

PbParagraphAlignmentType Enumeration (Publisher)
Send feedback

Represents the alignment for the specified paragraphs.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbParagraphAlignmentCenter | 1 | Center alignment
pbParagraphAlignmentDistribute | 4 | Distribute alignment
pbParagraphAlignmentDistributeAll | 9 | Distribute all
pbParagraphAlignmentDistributeCenterLast | 10 | Distribute center last
pbParagraphAlignmentDistributeEastAsia | 5 | Distribute East Asia
pbParagraphAlignmentInterCluster | 8 | Inter Cluster
pbParagraphAlignmentInterIdeograph | 7 | Inter Ideograph
pbParagraphAlignmentInterWord | 3 | Inter Word
pbParagraphAlignmentJustified | 6 | Justified
pbParagraphAlignmentKashida | 11 | Kashida
pbParagraphAlignmentLeft | 0 | Left aligment
pbParagraphAlignmentMixed | -9999999 | Mixed alignment
pbParagraphAlignmentRight | 2 | Right alignment


Wizard Object (Publisher)

 Copy code hover
[image]

Wizard Object (Publisher)
Send feedback

Represents the publication design associated with a publication or the wizard associated with a Design Gallery object.

Example

Use the Wizard property of a Document, Page, Shape or ShapeRange object to return a Wizard object. The following example reports on the publication design associated with the active publication, displaying its name and current settings.

Copy code Copy code
Dim wizTemp As Wizard
Dim wizproTemp As WizardProperty
Dim wizproAll As WizardProperties

Set wizTemp = ActiveDocument.Wizard

With wizTemp
 Set wizproAll = .Properties
 MsgBox "Publication Design associated with " _
 & "current publication: " _
 & .Name
 For Each wizproTemp In wizproAll
 With wizproTemp
 MsgBox " Wizard property: " _
 & .Name & " = " & .CurrentValueId
 End With
 Next wizproTemp
End With
Note Note

Depending on the language version of Microsoft Publisher that you are using, you may receive an error when using the above code. If this occurs, you will need to build in error handlers to circumvent the errors. The following example functions as the code above but has error handlers built in for this situation.
Copy code Copy code
Sub ExampleWithErrorHandlers()
 Dim wizTemp As Wizard
 Dim wizproTemp As WizardProperty
 Dim wizproAll As WizardProperties

 Set wizTemp = ActiveDocument.Wizard

 With wizTemp
 Set wizproAll = .Properties
 Debug.Print "Publication Design associated with " _
 & "current publication: " _
 & .Name
 For Each wizproTemp In wizproAll
 With wizproTemp
 If wizproTemp.Name = "Layout" Or wizproTemp _
 .Name = "Layout (Intl)" Then
 On Error GoTo Handler
 MsgBox " Wizard property: " _
 & .Name & " = " & .CurrentValueId

Handler:
 If Err.Number = 70 Then Resume Next
 Else
 MsgBox " Wizard property: " _
 & .Name & " = " & .CurrentValueId
 End If
 End With
 Next wizproTemp
 End With
End Sub


Document.Redo Event (Publisher)

 Copy code hover
[image]

Document.Redo Event (Publisher)
Send feedback

Occurs when reversing the last action that was undone.

Syntax

expression .Redo

expression A variable that represents a Document object.

Remarks

The Redo event occurs immediately after the action is redone.

If multiple actions are redone, the Redo event occurs only once, after all the actions are complete.

For more information about using events with the Document object, see Using Events with the Document Object.

Example

This example displays a message when a user clicks Undo on the Standard toolbar or selects Redo from the Edit menu. For this routine to work with the current publication, you must put it in the ThisDocument module.

Copy code Copy code
Private Sub DocPub_Redo()
 MsgBox "Your last undo has been reversed."
End Sub

To trap this event from a non-Microsoft Publisher project, you must place the following code in the General Declarations section of your module and run the InitiatePubApp routine.

Copy code Copy code
Private WithEvents DocPub As Publisher.Document

Sub InitiatePubApp()
 Set DocPub = Publisher.ActiveDocument
End Sub


ShapeRange.HorizontalFlip Property (Publisher)

 Copy code hover
[image]

ShapeRange.HorizontalFlip Property (Publisher)
Send feedback

Indicates whether the specified shape has been flipped around its horizontal axis. Read-only.

Syntax

expression .HorizontalFlip

expression A variable that represents a ShapeRange object.

Remarks

The HorizontalFlip property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The shape has not been flipped around its horizontal axis.
msoTriStateMixed | Indicates a combination of msoTrue and msoFalse for the specified shape range.
msoTrue | The shape has been flipped around its horizontal axis.

Example

This example restores each shape on the active publication to its original state if it has been flipped horizontally or vertically.

VBA Copy code Copy code
Sub Flipper()

 Dim shpS As Shape

 For Each shpS In ActiveDocument.MasterPages.Item(1).Shapes
 If shpS.HorizontalFlip = msoTrue Then shpS.Flip msoFlipHorizontal
 If shpS.VerticalFlip = msoTrue Then shpS.Flip msoFlipVertical
 Next

End Sub


MailMergeMappedDataFields.Item Method (Publisher)

 Copy code hover
[image]

MailMergeMappedDataFields.Item Method (Publisher)
Send feedback

Returns an individual object in a specified collection.

Syntax

expression .Item(Index)

expression A variable that represents a MailMergeMappedDataFields object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The number or name of the field or list box item to return.

Return Value

MailMergeMappedDataField

Example

This example returns the "City" field from a mapped data fields object.

VBA Copy code Copy code
Dim mmfTemp As MailMergeMappedDataField

Set mmfTemp = ActiveDocument.MailMerge _
 .DataSource.MappedDataFields.Item(Index:="City")


MailMergeDataSource.LastRecord Property (Publisher)

 Copy code hover
[image]

MailMergeDataSource.LastRecord Property (Publisher)
Send feedback

Returns or sets a Long that represents the number of the last record to be merged in a mail merge or catalog merge operation. Read/write.

Syntax

expression .LastRecord

expression A variable that represents a MailMergeDataSource object.

Return Value

Long

Example

This example sets the active record as the first record to be merged and then sets the last record as the record two records forward in the data source. This example assumes that the active publication is a mail merge publication.

Copy code Copy code
Sub RecordOne()
 With ActiveDocument.MailMerge
 .DataSource.FirstRecord = .DataSource.ActiveRecord
 .DataSource.LastRecord = .DataSource.ActiveRecord + 2
 .Execute Pause:=True
 End With
End Sub


PictureFormat.Parent Property (Publisher)

 Copy code hover
[image]

PictureFormat.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a PictureFormat object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


ParagraphFormat.UseCharBasedFirstLineIndent Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.UseCharBasedFirstLineIndent Property (Publisher)
Send feedback

Returns or sets an MsoTriState constant that specifies whether a paragraph is indented using East Asian character width. Read/write.

Syntax

expression .UseCharBasedFirstLineIndent

expression A variable that represents an ParagraphFormat object.

Return Value

MsoTriState

Remarks

The UseCharBasedFirstLineIndent property value can be one of the MsoTriState constants declared in the Microsoft Office type library.

The value of UseCharBasedFirstLineIndent can be set only if East Asian languages are enabled on the client computer, whereas the value can be returned regardless of whether East Asian languages are enabled. Note that UseCharBasedFirstLineIndent must be set before the CharBasedFirstLineIndent property can be returned or set. A run-time "permission denied" error is returned if UseCharBasedFirstLineIndent is not set first.

If UseCharBasedFirstLineIndent is msoTrue, the paragraph is indented using East Asian character width, and if it is msoFalse it is not. The default value is msoFalse.

Example

The following example creates a text box on the fourth page of the active publication. After the UseCharBasedFirstLineIndent property is set to True, the width of the first line indent is set to 15 points by using the CharBasedFirstLineIndent property. Font properties are then set, and text is inserted into the paragraph.

VBA Copy code Copy code
Dim theTextBox As Shape

Set theTextBox = ActiveDocument.Pages(4).Shapes _
 .AddShape(msoShapeRectangle, 100, 100, 300, 200)

With theTextBox
 .TextFrame.TextRange.ParagraphFormat _
 .UseCharBasedFirstLineIndent = msoTrue
 .TextFrame.TextRange.ParagraphFormat _
 .CharBasedFirstLineIndent = 15
 .TextFrame.TextRange.Font.Name = "Verdana"
 .TextFrame.TextRange.Font.Size = 12
 .TextFrame.TextRange.Text = "This is a test sentence." _
 & Chr(13) & "This is another test sentence."
End With


WebNavigationBarSets.Item Method (Publisher)

 Copy code hover
[image]

WebNavigationBarSets.Item Method (Publisher)
Send feedback

Returns an individual object in a specified collection.

Syntax

expression .Item(Index)

expression A variable that represents a WebNavigationBarSets object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The number or name of the field or list box item to return.

Return Value

WebNavigationBarSet


Font.Parent Property (Publisher)

 Copy code hover
[image]

Font.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a Font object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Page.WebPageOptions Property (Publisher)

 Copy code hover
[image]

Page.WebPageOptions Property (Publisher)
Send feedback

Returns a WebPageOptions object, which represents the properties of a single Web page within a Web publication. Read-only.

Syntax

expression .WebPageOptions

expression A variable that represents a Page object.

Return Value

WebPageOptions

Example

The following example sets the description and the background sound for the fourth page of the active Web publication.

VBA Copy code Copy code
With ActiveDocument.Pages(4).WebPageOptions
 .Description = "Company Profile"
 .BackgroundSound = "C:\CompanySounds\corporate_jingle.wav"
End With


FillFormat.PresetTexture Property (Publisher)

 Copy code hover
[image]

FillFormat.PresetTexture Property (Publisher)
Send feedback

Returns an MsoPresetTexture constant that represents the preset texture for the specified fill. Read-only.

Syntax

expression .PresetTexture

expression A variable that represents a FillFormat object.

Return Value

MsoPresetTexture

Remarks

The PresetTexture property value can be one of the MsoPresetTexture constants declared in the Microsoft Office type library.

Use the PresetTextured method to specify the preset texture for the fill.

Example

This example adds a rectangle to the first page in the active publication and sets its preset texture to match that of the first shape on the page. For the example to work, the first shape must have a preset textured fill.

VBA Copy code Copy code
Sub SetTexture()
 Dim texture As MsoPresetTexture
 With ActiveDocument.Pages(1).Shapes
 texture = .Item(1).Fill.PresetTexture
 With .AddShape(Type:=msoShapeRectangle, Left:=250, Top:=72, _
 Width:=40, Height:=80)
 .Fill.PresetTextured PresetTexture:=texture
 End With
 End With
End Sub


WebListBoxItems Methods (Publisher)

 Copy code hover
[image]

WebListBoxItems Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
AddItem | Adds list items to a Web list box control.
Delete | Deletes the specified hidden Web field or Web list box item object.
Item | Returns a String corresponding to the value of a hidden field in a Web form or a list item in a Web list box control.
Selected | Selects or cancels the selection of an item in a Web list box control.


OLEFormat.DoVerb Method (Publisher)

 Copy code hover
[image]

OLEFormat.DoVerb Method (Publisher)
Send feedback

Requests that an OLE object perform one of its verbs.

Syntax

expression .DoVerb(iVerb)

expression A variable that represents an OLEFormat object.

Parameters

Name | Required/Optional | Data Type | Description
iVerb | Required | Long | The verb to perform.

Remarks

Use the ObjectVerbs property to determine the available verbs for an OLE object.

Example

This example performs the first verb for the third shape on the first page of the active publication if the shape is a linked or embedded OLE object.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes(3)
 If .Type = pbEmbeddedOLEObject Or _
 .Type = pbLinkedOLEObject Then
 .OLEFormat.DoVerb (1)
 End If
End With

This example performs the verb "Open" for the third shape on the first page of the active publication if the shape is an OLE object that supports the verb "Open."

Copy code Copy code
Dim strVerb As String
Dim intVerb As Integer

With ActiveDocument.Pages(1).Shapes(3)

 ' Verify that the shape is an OLE object.
 If .Type = pbEmbeddedOLEObject Or _
 .Type = pbLinkedOLEObject Then

 ' Loop through the ObjectVerbs collection
 ' until the "Open" verb is found.
 For Each strVerb In .OLEFormat.ObjectVerbs
 intVerb = intVerb + 1
 If strVerb = "Open" Then

 ' Perform the "Open" verb.
 .OLEFormat.DoVerb iVerb:=intVerb
 Exit For
 End If
 Next strVerb
 End If
End With


TextFrame.Parent Property (Publisher)

 Copy code hover
[image]

TextFrame.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a TextFrame object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Document.WizardAfterChange Event (Publisher)

 Copy code hover
[image]

Document.WizardAfterChange Event (Publisher)
Send feedback

Occurs after the user chooses an option in the wizard pane that changes any of the following settings in the publication: page layout (page size, fold type, orientation, label product), print setup (paper size, print tiling), adding or deleting objects, adding or deleting pages, or object or page formatting (size, position, fill, border, background, default text, text formatting).

Syntax

expression .WizardAfterChange

expression A variable that represents a Document object.

Remarks

The WizardAfterChange event only occurs once regardless of the scope or number of individual modifications made to the publication.

To access the Document object events, declare a Document object variable in the General Declarations section of a class module, then set the variable equal to the Document object for which you want to access events.

For more information about using events with the Document object, see Using Events with the Document Object .

Example

This example displays a message when a publication is altered using the wizard pane. (The procedure can be stored in the ThisDocument module of a publication.)

Copy code Copy code
Private Sub Document_WizardAfterChange()
 MsgBox "Remember to save changes made " _
 & "through the wizard pane!"
End Sub


CellBorder Object (Publisher)

 Copy code hover
[image]

CellBorder Object (Publisher)
Send feedback

Represents the color and weight settings for cell borders.

Example

Use the various border properties of the Cell object to return the different borders of a cell (left, right, top, bottom, and diagonal). The following example retrieves the top border of the first cell in a table.

Copy code Copy code
Dim cbTemp As CellBorder

Set cbTemp = ActiveDocument.Pages(1) _
 .Shapes(1).Table.Cells.Item(1).BorderTop

Use the Color and Weight properties of the CellBorder object to format the appearance of a cell border. The following example makes the left border of the first cell in a table red and two points thick.

Copy code Copy code
Dim cbTemp As CellBorder

Set cbTemp = ActiveDocument.Pages(1) _
 .Shapes(1).Table.Cells.Item(1).BorderLeft

cbTemp.Color.RGB = RGB(255, 0, 0)
cbTemp.Weight = 2


Page.Application Property (Publisher)

 Copy code hover
[image]

Page.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a Page object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


PbColorScheme Enumeration (Publisher)

 Copy code hover
[image]

PbColorScheme Enumeration (Publisher)
Send feedback

Represents a color scheme returned by the Item property. It is a set of coordinated colors used collectively in a publication to provide consistent color.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbColorSchemeAlpine | -1 | Alpine
pbColorSchemeAqua | -2 | Aqua
pbColorSchemeBerry | -3 | Berry
pbColorSchemeBlackGray | -4 | Black Gray
pbColorSchemeBlackWhite | -58 | Black and White
pbColorSchemeBrown | -5 | Brown
pbColorSchemeBurgundy | -6 | Burgundy
pbColorSchemeCavern | -7 | Cavern
pbColorSchemeCelebration | -1004 | Celebration
pbColorSchemeCherry | -1002 | Cherry
pbColorSchemeCitrus | -8 | Citrus
pbColorSchemeClay | -9 | Clay
pbColorSchemeCranberry | -10 | Cranberry
pbColorSchemeCrocus | -11 | Crocus
pbColorSchemeCustom | 1 | Custom
pbColorSchemeDarkBlue | -61 | DarkBlue
pbColorSchemeDesert | -12 | Desert
pbColorSchemeField | -13 | Field
pbColorSchemeFirstUserDefined | 2000 | FirstUserDefined
pbColorSchemeFjord | -14 | Fjord
pbColorSchemeFloral | -15 | Floral
pbColorSchemeGarnet | -16 | Garnet
pbColorSchemeGlacier | -17 |
pbColorSchemeGreen | -59 | Green
pbColorSchemeHeather | -18 | Heather
pbColorSchemeIris | -19 | Iris
pbColorSchemeIsland | -20 | Island
pbColorSchemeIvy | -21 | Ivy
pbColorSchemeLagoon | -22 | Lagoon
pbColorSchemeLilac | -23 | Lilac
pbColorSchemeMahogany | -24 |
pbColorSchemeMarine | -25 | Marine
pbColorSchemeMaroon | -26 | Maroon
pbColorSchemeMeadow | -27 | Meadow
pbColorSchemeMist | -28 | Mist
pbColorSchemeMistletoe | -29 | Mistletoe
pbColorSchemeMonarch | -41 | Monarch
pbColorSchemeMoss | -30 | Moss
pbColorSchemeMountain | -31 | Mountain
pbColorSchemeMulberry | -32 | Mulberry
pbColorSchemeNavy | -33 | Navy
pbColorSchemeNutmeg | -34 | Nutmeg
pbColorSchemeOcean | -1000 | Ocean
pbColorSchemeOlive | -35 | Olive
pbColorSchemeOrange | -1003 | Orange
pbColorSchemeOrchid | -36 | Orchid
pbColorSchemeParrot | -37 | Parrot
pbColorSchemePeach | -1005 | Peach
pbColorSchemePebbles | -38 | Pebbles
pbColorSchemePrairie | -39 | Prairie
pbColorSchemePurple | -1001 | Purple
pbColorSchemeRainForest | -40 | Rain Forest
pbColorSchemeRed | -60 | Red
pbColorSchemeRedwood | -42 | Redwood
pbColorSchemeReef | -43 | Reef
pbColorSchemeSagebrush | -44 | Sagebrush
pbColorSchemeSapphire | -45 | Sapphire
pbColorSchemeShamrock | -46 | Shamrock
pbColorSchemeSienna | -47 | Sienna
pbColorSchemeSpice | -48 | Spice
pbColorSchemeSunrise | -49 | Sunrise
pbColorSchemeSunset | -50 | Sunset
pbColorSchemeTeal | -51 | Teal
pbColorSchemeTidepool | -52 | Tidepool
pbColorSchemeTropics | -53 | Tropics
pbColorSchemeTrout | -54 | Trout
pbColorSchemeVineyard | -55 | Vineyard
pbColorSchemeWaterfall | -56 | Waterfall
pbColorSchemeWildflower | -57 | Wildflower


WizardValue.Application Property (Publisher)

 Copy code hover
[image]

WizardValue.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a WizardValue object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


OLEFormat.Object Property (Publisher)

 Copy code hover
[image]

OLEFormat.Object Property (Publisher)
Send feedback

Returns an Object that represents the specified OLE object's top-level interface. This property allows you to access the properties and methods of an ActiveX control or the application in which an OLE object was created. The OLE object must support OLE Automation for this property to work. Read-only.

Syntax

expression .Object

expression A variable that represents an OLEFormat object.

Return Value

Object

Example

This example sets the value of the first shape in the active publication. For the example to work, this first shape must be an ActiveX control (for example, a check box or an option button).

VBA Copy code Copy code
Dim myObj As Object

With ActiveDocument.Pages(1).Shapes(1).OLEFormat
 .Activate
 Set myObj = .Object
End With

myObj.Value = True


WebPageOptions.BackgroundSound Property (Publisher)

 Copy code hover
[image]

WebPageOptions.BackgroundSound Property (Publisher)
Send feedback

Returns or sets a String that specifies the path to a sound file that is played when the Web page is loaded in a Web browser. Read/write.

Syntax

expression .BackgroundSound

expression A variable that represents a WebPageOptions object.

Return Value

String

Remarks

The path to the background sound file must be a network path or a local path; an http:// address will not work.

If BackgroundSound is specified, the background sound will play once by default. The SetBackgroundSoundRepeat method can be used to specify whether the background sound should be played infinitely, and if it should not, to specify the number of times the background sound file should be played.

The background sound can be any of the following file types:

*.wav

*.mid

*.midi

*.rmi

*.au

*.aif

*.aiff

Example

The following example sets the background sound for page four of the active Web publication to a .wav file on the local computer. This .wav file will play once when the page is loaded in a Web browser.

Copy code Copy code
Dim theWPO As WebPageOptions

Set theWPO = ActiveDocument.Pages(4).WebPageOptions

With theWPO
 .BackgroundSound = "C:\CompanySounds\corporate_jingle.wav"
End With


InlineShapes Methods (Publisher)

 Copy code hover
[image]

InlineShapes Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Item | Returns a Shape object that represents an inline shape contained in a text range. This method is the default member of the InlineShapes collection.


Document.FindShapeByWizardTag Method (Publisher)

 Copy code hover
[image]

Document.FindShapeByWizardTag Method (Publisher)
Send feedback

Returns a ShapeRange object representing one or all of the shapes placed in a publication by a wizard and bearing the specified wizard tag.

Syntax

expression .FindShapeByWizardTag(WizardTag, Instance)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
WizardTag | Required | PbWizardTag | Specifies the wizard tag for which to search.
Instance | Optional | Long | Specifies which instance of a shape with the specified wizard tag is returned. For Instance equal to n, the nth instance of a shape with the specified wizard tag is returned. If no value for Instance is specified, all the shapes with the specified wizard tag are returned.

Return Value

ShapeRange

Remarks

The WizardTag parameter can be one of the PbWizardTag constants declared in the Microsoft Publisher type library.

Example

The following example finds the second instance of a shape with the wizard tag pbWizardDate and assigns it to a variable.

VBA Copy code Copy code
Dim shpWizardTag As Shape

Set shpWizardTag = ActiveDocument._
 FindShapeByWizardTag(WizardTag:=pbWizardDate, Instance:=2)


Document.ChangeDocument Method (Publisher)

 Copy code hover
[image]

Document.ChangeDocument Method (Publisher)
Send feedback

Changes the current publication to one that uses the wizard, and optionally the design, that you specify.

Version Information

Version Added: Publisher 2007

Syntax

expression .ChangeDocument(Wizard, Design)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Wizard | Required | PbWizard | The type of wizard. See Remarks for possible values.
Design | Optional | Long | The design type.

Remarks

Possible values for the Wizard parameter are declared in the PbWizard enumeration in the Publisher type library.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the ChangeDocument method to change the wizard used by the current publicaton to a brochure.

VBA Copy code Copy code
Public Sub ChangeDocument_Example()

 ThisDocument.ChangeDocument pbWizardBrochures

End Sub


PbSubmitDataRetrievalMethodType Enumeration (Publisher)

 Copy code hover
[image]

PbSubmitDataRetrievalMethodType Enumeration (Publisher)
Send feedback

Represents the way data from a Web form is processed.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbSubmitDataRetrievalEmail | 2 | Processes form data by sending an e-mail message to a specified e-mail address.
pbSubmitDataRetrievalProgram | 3 | Processes form data using a script program provided by your Internet service provider.
pbSubmitDataRetrievalSaveOnServer | 1 | Saves form data to a file stored on your Web server.


Shape.IncrementTop Method (Publisher)

 Copy code hover
[image]

Shape.IncrementTop Method (Publisher)
Send feedback

Moves the specified shape or shape range vertically by the specified distance.

Syntax

expression .IncrementTop(Increment)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Variant | The vertical distance to move the shape or shape range. A positive value moves the shape or shape range down; a negative value moves it up. Numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

Remarks

Use the IncrementLeft method to move shapes or shape ranges horizontally.

Example

This example duplicates the first shape on the active publication, sets the fill for the duplicate, moves it 70 points to the right and 50 points up, and rotates it 30 degrees clockwise.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes(1).Duplicate
 .Fill.PresetTextured PresetTexture:=msoTextureGranite
 .IncrementLeft Increment:=70
 .IncrementTop Increment:=-50
 .IncrementRotation Increment:=30
End With


ReflectionFormat.Visible Property (Publisher)

 Copy code hover
[image]

ReflectionFormat.Visible Property (Publisher)
See also Send feedback

True if the specified object or the formatting applied to it is visible. Read/write MsoTriState.

Version Information

Version Added: Publisher 2013

Syntax

expression .Visible

expression A variable that represents a ReflectionFormat object.

Return value

MsoTriState

See also

Other resources

ReflectionFormat Object Members
ReflectionFormat Object


Printer.Application Property (Publisher)

 Copy code hover
[image]

Printer.Application Property (Publisher)
Send feedback

Returns an Application object that represents the creator of the parent Printer object. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .Application

expression A variable that represents a Printer object.

Return Value

Application


WebNavigationBarSet Members (Publisher)

 Copy code hover
[image]

WebNavigationBarSet Members (Publisher)
Send feedback

Represents a Web navigation bar set for the current document. The WebNavigationBarSet object is a member of the WebNavigationBarSets collection, which includes all of the Web navigation bar sets in the current document.

Methods

Name | Description
AddToEveryPage | Adds a ShapeRange of type pbWebNavigationBar to each page of the current document.
ChangeOrientation | Sets a PbNavBarOrientation constant that represents the alignment of the navigation bar; vertical or horizontal.
DeleteSetAndInstances | Deletes a Web navigation bar set and all instances of it in the current document.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
AutoUpdate | True if all pages will be added to the specified Web navigation bar set and that adding new pages will update the navigation bar with a corresponding item. Pages must have the AddHyperlinkToWebNavbar set to True or WebPageOptions.IncludePageOnNewWebNavigationBars property set to True to be added or updated within the specified WebNavigationBarSet. Read/write Boolean.
ButtonStyle | Sets or returns a PbWizardNavBarButtonStyle constant that represents the style of the navigation bar buttons: large, small, or text-only. Read/write.
Design | Sets or returns a PbWizardNavBarDesign constant representing the design of the specified Web navigation bar set. Read/write.
HorizontalAlignment | Sets or returns a PbWizardNavBarAlignment constant that represents the horizontal alignment of the buttons in a Web navigation bar set. Read/write.
HorizontalButtonCount | Sets or returns a Long representing the number of buttons in each row of buttons for a Web navigation bar set. Read/write. Long.
IsHorizontal | True if the specified WebNavigationBarSet has a horizontal orientation. Read-only Boolean.
Links | Returns a WebNavigationBarHyperlinks collection containing all of the hyperlinks in the specified Web navigation bar set. Read/write.
Name | Indicates the name of the specified Web navigation bar set. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
ShowSelected | True if the selected button is highlighted for the specified WebNavigationBarSet object. Read/write Boolean.


Options.UseWizardForBlankPublication Property (Publisher)

 Copy code hover
[image]

Options.UseWizardForBlankPublication Property (Publisher)
Send feedback

Gets or sets whether to use a wizard for blank publications. Read/Write.

Version Information

Version Added: Publisher 2007

Syntax

expression .UseWizardForBlankPublication

expression A variable that represents an Options object.

Return Value

Boolean

Remarks

The setting of the UseWizardForBlankPublication property corresponds to the setting of the Use a wizard for blank publications check box on the User Assistance tab of the Options dialog box (Tools menu).


ParagraphFormat.Application Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a ParagraphFormat object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


PrintableRect.Top Property (Publisher)

 Copy code hover
[image]

PrintableRect.Top Property (Publisher)
Send feedback

Returns the a Single that represents the distance (in points) from the top edge of the printer sheet to the top edge of the printable rectangle. Read-only.

Syntax

expression .Top

expression A variable that represents a PrintableRect object.


TextStyle.BaseStyle Property (Publisher)

 Copy code hover
[image]

TextStyle.BaseStyle Property (Publisher)
Send feedback

Returns or sets a String that represents the style upon which the formatting of another style is based. Read/write.

Syntax

expression .BaseStyle

expression A variable that represents a TextStyle object.

Return Value

String

Example

This example sets the base formatting of the style named Body Text to the formatting of the Normal style.

Copy code Copy code
Sub SetBaseStyle()
 With ActiveDocument.TextStyles
 .Add "Body Text"
 .Item("Body Text").BaseStyle = "Normal"
 End With
End Sub


ShapeRange.Glow Property (Publisher)

 Copy code hover
[image]

ShapeRange.Glow Property (Publisher)
See also Send feedback

Returns a GlowFormat object that represents the glow formatting for a range of shapes. Read-only.

Version Information

Version Added: Publisher 2013

Syntax

expression .Glow

expression A variable that represents a ShapeRange object.

Return value

GLOWFORMAT

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


Field Methods (Publisher)

 Copy code hover
[image]

Field Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Unlink | Replaces the specified field or Fields collection with with their most recent results.


CalloutFormat Members (Publisher)

 Copy code hover
[image]

CalloutFormat Members (Publisher)
Send feedback

Contains properties and methods that apply to line callouts.

Methods

Name | Description
AutomaticLength | Specifies that the first segment of the callout line (the segment attached to the text callout box) be scaled automatically when the callout is moved.
CustomDrop | Sets the vertical distance from the edge of the text bounding box to the place where the callout line attaches to the text box.
CustomLength | Specifies that the first segment of the callout line (the segment attached to the text callout box) retain a fixed length whenever the callout is moved.
PresetDrop | Specifies whether the callout line attaches to the top, bottom, or center of the callout text box or whether it attaches at a point that is a specified distance from the top or bottom of the text box.

Properties

Name | Description
Accent | Returns or sets an MsoTriState constant indicating whether a vertical accent bar separates the callout text from the callout line. Read/write.
Angle | Returns or sets an MsoCalloutAngleType constant that represents the angle of the callout line. If the callout line contains more than one line segment, this property returns or sets the angle of the segment that is farthest from the callout text box. Read/write.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
AutoAttach | Returns or sets an MsoTriState constant indicating whether the place where the callout line attaches to the callout text box changes depending on whether the origin of the callout line (where the callout points) is to the left or right of the callout text box. Read/write.
AutoLength | Returns an MsoTriState constant indicating whether the first segment of the callout line is scaled when the callout is moved. Applies only to callouts whose lines consist of more than one segment (types msoCalloutThree and msoCalloutFour). Read-only.
Border | Returns or sets an MsoTriState constant indicating whether the text in the specified callout is surrounded by a border. Read/write.
Drop | For callouts with an explicitly set drop value, this property returns the vertical distance from the edge of the text bounding box to the place where the callout line attaches to the text box. This distance is measured from the top of the text box unless the AutoAttach property is set to True and the text box is to the left of the origin of the callout line (where the callout points). In this case, the drop distance is measured from the bottom of the text box. Read-only Variant.
DropType | Returns an MsoCalloutDropType constant indicating where the callout line attaches to the callout text box. Read-only.
Gap | Returns or sets a Variant indicating the horizontal distance between the end of the callout line and the text bounding box. Read/write.
Length | Returns a Variant indicating the length (in points) of the first segment of the callout line (the segment attached to the text callout box) if the AutoLength property of the specified callout is set to False. Otherwise, an error occurs. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Type | Returns or sets an MsoCalloutType constant that represents the callout type. Read/write.


TextRange.Cut Method (Publisher)

 Copy code hover
[image]

TextRange.Cut Method (Publisher)
Send feedback

Deletes the specified object and places it on the Clipboard.

Syntax

expression .Cut

expression A variable that represents a TextRange object.

Return Value

Nothing

Remarks

Use the Paste method to paste the contents of the Clipboard.

The Copy method can be used on Shape objects, but the Paste method cannot.

Example

This example deletes shape one and shape two from page one of the active publication, places copies of them on the Clipboard, and then pastes the copies onto page two.

Copy code Copy code
With ActiveDocument
    .Pages(1).Shapes.Range(Array(1, 2)).Cut
    .Pages(2).Shapes.Paste
End With

This example deletes shape one on page one of the active publication and places a copy of it on the Clipboard.

Copy code Copy code
ActiveDocument
Copy code Copy code
.Pages(1).Shapes(1).Cut

This example deletes the text in shape one on page one of the active publication and places a copy of it on the Clipboard.

Copy code Copy code
ActiveDocument
Copy code Copy code
.Pages(1).Shapes(1).TextFrame.TextRange.Cut


EmailMergeEnvelope.To Property (Publisher)

 Copy code hover
[image]

EmailMergeEnvelope.To Property (Publisher)
Send feedback

Gets or sets the MailMergeDataField object that represents the data-source field (column) that lists the e-mail addresses of recipients of the merged e-mail message. Read/write.

Version Information

Version Added: Publisher 2007

Syntax

expression .To

expression A variable that represents an EmailMergeEnvelope object.

Return Value

MailMergeDataField

Remarks

You must make certain that you assign the correct data-source field (the one that represents e-mail addresses) to the To property. You can use the following line of code, which gets the value of the Name property of the MailMergeDataField object to which To is assigned, to ensure that you make the correct assignment:

VBA Copy code Copy code
Debug.Print ThisDocument.MailMerge.EmailMergeEnvelope.To.Name

For an example of how to set the To property value, see the EmailMergeEnvelope object topic.


WebCheckBox.Application Property (Publisher)

 Copy code hover
[image]

WebCheckBox.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a WebCheckBox object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


SoftEdgeFormat Object (Publisher)

 Copy code hover
[image]

SoftEdgeFormat Object (Publisher)
See also Send feedback

Represents the soft edge formatting for a shape or range of shapes.

Version Information

Version Added: Publisher 2013

See also

Other resources

SoftEdgeFormat Members (Publisher)


Columns.Item Method (Publisher)

 Copy code hover
[image]

Columns.Item Method (Publisher)
Send feedback

Returns an individual Column object in the specified Columns collection.

Syntax

expression .Item(Index)

expression A variable that represents a Columns object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The number of the object to return.

Return Value

Column

Example

This example returns the first column from a Columns collection.

VBA Copy code Copy code
Dim colTemp As Column

Set colTemp = ActiveDocument.Pages(Index:=1) _
 .Shapes(1).Table.Columns.Item(Index:=1)


Shape.WebCommandButton Property (Publisher)

 Copy code hover
[image]

Shape.WebCommandButton Property (Publisher)
Send feedback

Returns the WebCommandButton object associated with the specified shape.

Syntax

expression .WebCommandButton

expression A variable that represents a Shape object.

Return Value

WebCommandButton

Example

This example creates a Web form Submit command button and sets the script path and file name to run when a user clicks the button.

VBA Copy code Copy code
Dim shpNew As Shape
Dim wcbTemp As WebCommandButton

Set shpNew = ActiveDocument.Pages(1).Shapes.AddWebControl _
 (Type:=pbWebControlCommandButton, Left:=150, _
 Top:=150, Width:=75, Height:=36)

Set wcbTemp = shpNew.WebCommandButton

With wcbTemp
 .ButtonText = "Submit"
 .ButtonType = pbCommandButtonSubmit
 .ActionURL = "http://www.tailspintoys.com/" _
 & "scripts/ispscript.cgi"
End With


Hyperlinks.Application Property (Publisher)

 Copy code hover
[image]

Hyperlinks.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a Hyperlinks object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


MailMergeMappedDataField.DataFieldName Property (Publisher)

 Copy code hover
[image]

MailMergeMappedDataField.DataFieldName Property (Publisher)
Send feedback

Returns or sets a String which represents the name of the field in the mail merge data source to which a mapped data field maps. An empty string is returned if the specified data field is not mapped to a mapped data field. Read/write.

Syntax

expression .DataFieldName

expression A variable that represents a MailMergeMappedDataField object.

Return Value

String

Example

This example creates a table on a new page of the current publication and lists the mapped data fields available and the fields in the data source to which they are mapped. This example assumes that the current publication is a mail merge publication and that the data source fields have corresponding mapped data fields.

Copy code Copy code
Sub MappedFields()
 Dim intCount As Integer
 Dim intRows As Integer
 Dim docPub As Document
 Dim pagNew As Page
 Dim shpTable As Shape
 Dim tblTable As Table
 Dim rowTable As Row

 On Error Resume Next

 Set docPub = ThisDocument
 Set pagNew = ThisDocument.Pages.Add(Count:=1, After:=1)
 intRows = docPub.MailMerge.DataSource.MappedDataFields.Count + 1

 'Creates new table with a heading row
 Set shpTable = pagNew.Shapes.AddTable(NumRows:=intRows, _
 numColumns:=2, Left:=100, Top:=100, Width:=400, Height:=12)
 Set tblTable = shpTable.Table
 With tblTable.Rows(1)
 With .Cells(1).Text
 .Text = "Mapped Data Field"
 .Font.Bold = msoTrue
 End With
 With .Cells(2).Text
 .Text = "Data Source Field"
 .Font.Bold = msoTrue
 End With
 End With

 With docPub.MailMerge.DataSource
 For intCount = 2 To intRows - 1
 'Inserts mapped data field name and the
 'corresponding data source field name
 tblTable.Rows(intCount - 1).Cells(1).Text _
 .Text = .MappedDataFields(Index:=intCount).Name
 tblTable.Rows(intCount - 1).Cells(2).Text _
 .Text = .MappedDataFields(Index:=intCount).DataFieldName
 Next
 End With
End Sub


Font.Fill Property (Publisher)

 Copy code hover
[image]

Font.Fill Property (Publisher)
See also Send feedback

Returns a FillFormat object that contains fill formatting properties for the font used by the specified range of text. Read-only.

Version Information

Version Added: Publisher 2013

Syntax

expression .Fill

expression A variable that represents a Font object.

Return value

FILLFORMAT

See also

Concepts

Font Object

Other resources

Font Object Members


CellRange.Parent Property (Publisher)

 Copy code hover
[image]

CellRange.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a CellRange object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


ParagraphFormat.Tabs Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.Tabs Property (Publisher)
Send feedback

Returns a TabStops object representing the custom and default tabs for a paragraph or group of paragraphs.

Syntax

expression .Tabs

expression A variable that represents a ParagraphFormat object.

Return Value

TabStops

Example

The following example adds two tab stops to the selected paragraphs. The first tab stop is a left-aligned tab with a dotted tab leader positioned at 1 inch (72 points). The second tab stop is centered and is positioned at 2 inches.

VBA Copy code Copy code
Dim tabsAll As TabStops

Set tabsAll = Selection.TextRange.ParagraphFormat.Tabs

With tabsAll
 .Add Position:=InchesToPoints(1), _
 Leader:=pbTabLeaderDot, Alignment:=pbTabAlignmentLeading
 .Add Position:=InchesToPoints(2), _
 Leader:=pbTabLeaderNone, Alignment:=pbTabAlignmentCenter
End With


FillFormat.GradientAngle Property (Publisher)

 Copy code hover
[image]

FillFormat.GradientAngle Property (Publisher)
See also Send feedback

Returns or sets the angle of the gradient fill for the specified fill format. Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .GradientAngle

expression A variable that represents a FillFormat object.

Return value

Single

Remarks

You can specify a gradient fill in the formatting for various shapes. The valid range of values for the GradientAngle property is from 0 to 359.9.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


WebOptions.EmailAsImg Property (Publisher)

 Copy code hover
[image]

WebOptions.EmailAsImg Property (Publisher)
Send feedback

True to send the entire publication page as a single JPEG image. Read/write Boolean.

Syntax

expression .EmailAsImg

expression A variable that represents an WebOptions object.

Return Value

Boolean

Remarks

This property can increase your message's compatibility with older e-mail clients, but may result in larger file size.

This property is accessible for print publications in addition to Web publications.

The properties of the WebOptions object are used to specify the behavior of Web publications. This means that when any of these properties are modified, newly created Web publications will inherit the modified properties.

This property corresponds to the check box in the E-Mail Options section of the Web tab of the Options dialog box.

Example

The following example sets Microsoft Publisher to e-mail publication pages as JPEG images.

Copy code Copy code
Application.WebOptions.EmailAsImg = True


Font.Italic Property (Publisher)

 Copy code hover
[image]

Font.Italic Property (Publisher)
Send feedback

Returns or sets an MsoTriState constant indicating whether the specified text is formatted as italic. Read/write.

Syntax

expression .Italic

expression A variable that represents an Font object.

Return Value

MsoTriState

Remarks

The Italic property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | None of the characters in the range are formatted as italic.
msoTriStateMixed | Return value indicating a combination of msoTrue and msoFalse for the specified shape range.
msoTriStateToggle | Set value that switches between msoTrue and msoFalse.
msoTrue | All of the characters in the range are formatted as italic.

Example

This example tests all the text in the second story of the active publication and, if it has some text formatted as italic, it sets all the text to italic. If the text is all italic or all not italic, a message is displayed informing the user that there is no mixed italic formatting.

VBA Copy code Copy code
Sub ItalicStory()

 Dim stf As Font

 Set stf = Application.ActiveDocument.Stories(2).TextRange.Font
 With stf
 If .Italic = msoTriStateMixed Then
 .Italic = msoTrue
 Else
 MsgBox "There is no mixed italic formatting in this story."
 End If
 End With

End Sub


Pages.AddWizardPage Method (Publisher)

 Copy code hover
[image]

Pages.AddWizardPage Method (Publisher)
Send feedback

Adds the specified new wizard page to a specified location in a publication.

Syntax

expression .AddWizardPage(After, PageType, AddHyperlinkToWebNavBar)

expression A variable that represents a Pages object.

Parameters

Name | Required/Optional | Data Type | Description
After | Required | Long | The page after which to place the new wizard page.
PageType | Optional | PbWizardPageType | The type of wizard page to add.
AddHyperlinkToWebNavBar | Optional | Boolean | Specifies whether a link to the new page will be added to the automatic navigation bars of existing pages. Default is False, which means that if this argument is omitted, links to this page will not be added to the automatic navigation bars of existing pages.

Remarks

You can add wizard pages only to similar wizard publications. For example, you can add a Catalog Calendar Wizard page to a catalog but not to a newsletter. An error occurs if you try to add a wizard page to a different type of publication.

The PageType parameter can be one of the PbWizardPageType constants declared in the Microsoft Publisher type library.

Example

This example creates a new catalog publication, adds the wizard calendar page after the first page of the catalog, and adds the page as a link to each Web navigation bar set of the publication.

VBA Copy code Copy code
Sub AddNewWizardPage()
 Dim PubApp As Publisher.Application
 Dim PubDoc As Publisher.Document
 Set PubApp = New Publisher.Application
 Set PubDoc = PubApp.NewDocument(Wizard:=pbWizardCatalogs, _
 Design:=7)
 PubDoc.Pages.AddWizardPage After:=1, _
 PageType:=pbWizardPageTypeCatalogCalendar, _
 AddHyperLinkToWebNavBar:=True
 PubApp.ActiveWindow.Visible = True
End Sub

This example verifies that the active document is a catalog and, if it is, adds a catalog form after the first page but does not add the page as a link in any Web navigation bar sets.

VBA Copy code Copy code
Sub InsertCatalogWizardPage()
 With ActiveDocument
 If .Wizard.ID = 161 Then
 .Pages.AddWizardPage After:=1, _
 PageType:=pbWizardPageTypeCatalogForm, _
 AddHyperLinkToWebNavBar:=False
 End If
 End With
End Sub


ShapeRange.IncrementRotation Method (Publisher)

 Copy code hover
[image]

ShapeRange.IncrementRotation Method (Publisher)
Send feedback

Changes the rotation of the specified shape around the z-axis (extends outward from the plane of the publication) by the specified number of degrees.

Syntax

expression .IncrementRotation(Increment)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how far the shape is to be rotated around the z-axis, in degrees. A positive value rotates the shape clockwise; a negative value rotates it counterclockwise. Valid values are between - 360 and 360.

Remarks

Use the Rotation property to set the absolute rotation of the shape.

To rotate a three-dimensional shape around the x-axis (horizontal) or the y-axis (vertical), use the IncrementRotationX method or the IncrementRotationY method, respectively.

Example

This example duplicates the first shape on the active publication, sets the fill for the duplicate, moves it 70 points to the right and 50 points up, and rotates it 30 degrees clockwise.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes(1).Duplicate
 .Fill.PresetTextured PresetTexture:=msoTextureGranite
 .IncrementLeft Increment:=70
 .IncrementTop Increment:=-50
 .IncrementRotation Increment:=30
End With


RulerGuides Object (Publisher)

 Copy code hover
[image]

RulerGuides Object (Publisher)
Send feedback

A collection of RulerGuide objects that represents a gridline used to align objects on a page.

Example

Use the Add method of the RulerGuides collection to add ruler gridlines to the RulerGuides collection. This example creates horizontal ruler guides and vertical ruler guides every half inch on the first page of the active publication.

Copy code Copy code
Sub SetRulerGuides()
 Dim intCount As Integer
 Dim intPos As Integer
 With ActiveDocument.Pages(1).RulerGuides
 For intCount = 1 To 16
 intPos = intPos + 36
 .Add Position:=intPos, Type:=pbRulerGuideTypeVertical
 Next intCount
 intPos = 0
 For intCount = 1 To 21
 intPos = intPos + 36
 .Add Position:=intPos, Type:=pbRulerGuideTypeHorizontal
 Next intCount
 End With
End Sub

Use the Count property to return the total number of ruler guides, horizontal and vertical, in the collection. The following example uses the Count property to create a loop that deletes each of the ruler guides in the collection.

Copy code Copy code
Sub RemoveAllGuides()
 Dim intCount As Integer
 With ActiveDocument.Pages(1).RulerGuides
 For intCount = 1 To .Count
 .Item(1).Delete
 Next intCount
 End With
End Sub


MailMerge.DocumentUpdating Property (Publisher)

 Copy code hover
[image]

MailMerge.DocumentUpdating Property (Publisher)
Send feedback

Returns or sets a Boolean indicating whether the screen is updated while mail merge code is running. Default is True (the screen is updated). Read/write.

Syntax

expression .DocumentUpdating

expression A variable that represents a MailMerge object.

Return Value

Boolean

Remarks

Turning document updating off during run time can speed execution of Microsoft Visual Basic code. However, we recommend that you provide some indication of status so that the user is aware that the program is functioning correctly.

Example

The following example turns off document updating at the beginning of a mail merge subroutine and turns it back on at the end of the subroutine.

Copy code Copy code
Sub MailMergeProcedure()
 ActiveDocument.MailMerge.DocumentUpdating = False ' Mail merge code.
ActiveDocument.MailMerge.DocumentUpdating = True
End Sub


Field.PhoneticGuide Property (Publisher)

 Copy code hover
[image]

Field.PhoneticGuide Property (Publisher)
Send feedback

Returns a PhoneticGuide object that represents the properties of phonetic text applied to a text range.

Syntax

expression .PhoneticGuide

expression A variable that represents a Field object.

Return Value

PhoneticGuide

Example

This example adds phonetic text to the selection and displays the text to which the phonetic text applies, which is the originally selected text. This example assumes text is selected. If no text is selected, the message box will be blank.

VBA Copy code Copy code
Sub AddPhoneticText()
 With Selection.TextRange.Fields.AddPhoneticGuide _
 (Range:=Selection.TextRange, Text:="ver-E nIs")
 MsgBox "The base text is " & .PhoneticGuide.BaseText
 End With
End Sub


TextFrame Members (Publisher)

 Copy code hover
[image]

TextFrame Members (Publisher)
Send feedback

Represents the text frame in a Shape object. Contains the text in the text frame and the properties that control the margins and orientation of the text frame.

Methods

Name | Description
BreakForwardLink | Breaks the forward link for the specified text frame, if such a link exists.
ValidLinkTarget | Determines whether the text frame of one shape can be linked to the text frame of another shape. Returns True if LinkTarget is a valid target, False if LinkTarget already contains text or is already linked, or if the shape does not support attached text.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
AutoFitText | Sets or returns a PbTextAutoFitType constant that represents how Microsoft Publisher automatically adjusts the text font size and the TextFrame objects size for best viewing. Read/write.
Columns | Returns or sets a Long that represents the number of guide columns on a page or the number of columns in a text frame. Read/write.
ColumnSpacing | Returns or sets a Variant that represents the amount of space between text columns. Read/write.
HasNextLink | Indicates whether the specified text frame has a valid forward text-box link. Read-only.
HasPreviousLink | Returns msoTrue if the specified text frame has a valid link to a backward text box and msoFalse if it does not. Read-only.
HasText | Returns an MsoTriState constant indicating whether the specified shape has text associated with it. Read-only.
IncludeContinuedFromPage | Determines whether the text "Continued from page pagenumber" appears in a text box when Microsoft Publisher links text boxes. Read/write.
IncludeContinuedOnPage | Determines whether the text "Continued on page pagenumber" appears in a text box when Microsoft Publisher links text boxes. Read/write.
MarginBottom | Returns or sets a Variant that represents the amount of space (in points) between the text and the bottom edge of a cell, text frame, or page. Read/write.
MarginLeft | Returns or sets a Variant that represents the amount of space (in points) between the text and the left edge of a cell, text frame, or page. Read/write.
MarginRight | Returns or sets a Variant that represents the amount of space (in points) between the text and the right edge of a cell, text frame, or page. Read/write.
MarginTop | Returns or sets a Variant that represents the amount of space (in points) between the text and the top edge of a cell, text frame, or page. Read/write.
NextLinkedTextFrame | Returns or sets a TextFrame object representing the text frame to which text flows from the specified text frame. Read/write.
Orientation | Returns or sets a PbTextOrientation constant that represents how text flows in a text box. Read/write.
Overflowing | Indicates whether the text frame contains more text than can fit into the text frame. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
PreviousLinkedTextFrame | Returns a TextFrame object representing the text frame from which text flows to the specified text frame.
Story | Returns a Story object that represents the story properties in a text range.
TextRange | Returns a TextRange object that represents the text that is attached to a shape, and properties and methods for manipulating the text.
VerticalTextAlignment | Returns or sets a PbVerticalTextAlignmentType constant that represents the vertical alignment of text in a text box. Read/write.


ShapeNodes.Insert Method (Publisher)

 Copy code hover
[image]

ShapeNodes.Insert Method (Publisher)
Send feedback

Inserts a new segment after the specified node of the freeform drawing.

Syntax

expression .Insert(Index, SegmentType, EditingType, X1, Y1, X2, Y2, X3, Y3)

expression A variable that represents a ShapeNodes object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The number of the node after which the new node is to be inserted.
SegmentType | Required | MsoSegmentType | The type of segment to be added.
EditingType | Required | MsoEditingType | Specifies the editing type of the new node.
X1 | Required | Variant | If the EditingType of the new segment is msoEditingAuto, this argument specifies the horizontal distance from the upper-left corner of the page to the endpoint of the new segment. If the EditingType of the new node is msoEditingCorner, this argument specifies the horizontal distance from the upper-left corner of the page to the first control point for the new segment.
Y1 | Required | Variant | If the EditingType of the new segment is msoEditingAuto, this argument specifies the vertical distance from the upper-left corner of the page to the endpoint of the new segment. If the EditingType of the new node is msoEditingCorner, this argument specifies the vertical distance from the upper-left corner of the page to the first control point for the new segment.
X2 | Optional | Variant | If the EditingType of the new segment is msoEditingCorner, this argument specifies the horizontal distance from the upper-left corner of the page to the second control point for the new segment. If the EditingType of the new segment is msoEditingAuto, do not specify a value for this argument.
Y2 | Optional | Variant | If the EditingType of the new segment is msoEditingCorner, this argument specifies the vertical distance from the upper-left corner of the page to the second control point for the new segment. If the EditingType of the new segment is msoEditingAuto, do not specify a value for this argument.
X3 | Optional | Variant | If the EditingType of the new segment is msoEditingCorner, this argument specifies the horizontal distance from the upper-left corner of the page to the endpoint of the new segment. If the EditingType of the new segment is msoEditingAuto, do not specify a value for this argument.
Y3 | Optional | Variant | If the EditingType of the new segment is msoEditingCorner, this argument specifies the vertical distance from the upper-left corner of the page to the endpoint of the new segment. If the EditingType of the new segment is msoEditingAuto, do not specify a value for this argument.

Remarks

For the X1, Y1, X2, Y2, X3, and Y3 arguments, numeric values are evaluated in points; strings can be in any units supported by Publisher (for example, "2.5 in").

SegmentType can be one of these MsoSegmentType constants.

msoSegmentCurve

msoSegmentLine

EditingType can be one of these MsoEditingType constants.

msoEditingAuto | Adds a node type appropriate to the segments being connected.
msoEditingCorner | Adds a corner node.

Example

This example adds a smooth node with a curved segment after node four in the third shape in the active publication. The shape must be a freeform drawing with at least four nodes.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes(3).Nodes
 .Insert Index:=4, _
 SegmentType:=msoSegmentCurve, _
 EditingType:=msoEditingAuto, _
 X1:=210, Y1:=100
End With


ShapeRange.BlackWhiteMode Property (Publisher)

 Copy code hover
[image]

ShapeRange.BlackWhiteMode Property (Publisher)
Send feedback

Returns or sets an MsoBlackWhiteMode constant indicating how the specified shape or shape range appears when the publication is viewed in black-and-white mode. Read/write.

Syntax

expression .BlackWhiteMode

expression A variable that represents a ShapeRange object.

Remarks

The BlackWhiteMode property value can be one of the MsoBlackWhiteMode constants declared in the Microsoft Office type library.

Example

This example sets the first shape in the active publication to appear in black-and-white mode. When you view the publication in black-and-white mode, the shape will appear black, regardless of what color it is in color mode.

VBA Copy code Copy code
ActiveDocument.Pages(1).Shapes(1).BlackWhiteMode = msoBlackWhiteBlack


Rows.Item Method (Publisher)

 Copy code hover
[image]

Rows.Item Method (Publisher)
Send feedback

Returns an individual object in a specified collection.

Syntax

expression .Item(Index)

expression A variable that represents a Rows object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The number of the object to return.

Return Value

Row


Shape.WebListBox Property (Publisher)

 Copy code hover
[image]

Shape.WebListBox Property (Publisher)
Send feedback

Returns the WebListBox object associated with the specified shape.

Syntax

expression .WebListBox

expression A variable that represents a Shape object.

Return Value

WebListBox

Example

This example creates a new Web list box and adds several items to it. Note that when initially created, a Web list box control contains three default items. This example includes a loop that deletes the default list box items before adding new items.

VBA Copy code Copy code
Dim shpNew As Shape
Dim wlbTemp As WebListBox
Dim intCount As Integer

Set shpNew = ActiveDocument.Pages(1).Shapes _
 .AddWebControl(Type:=pbWebControlListBox, Left:=100, _
 Top:=150, Width:=300, Height:=72)

Set wlbTemp = shpNew.Web ListBox

With wlbTemp
 .MultiSelect = msoFalse

 With .ListBoxItems
 For intCount = 1 To .Count
 .Delete (1)
 Next intCount

 .AddItem Item:="Green"
 .AddItem Item:="Purple"
 .AddItem Item:="Red"
 .AddItem Item:="Black"
 End With
End With


MailMergeDataSources Properties (Publisher)

 Copy code hover
[image]

MailMergeDataSources Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the creator of the parent MailMergeDataSources collection. Read-only.
Count | Returns the number of MailMergeDataSource objects in the MailMergeDataSources collection of the active document. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the MailMergeDataSources object was created. Read-only.
Parent | Returns the parent of the MailMergeDataSources collection. Read-only.


Shapes.AddOLEObject Method (Publisher)

 Copy code hover
[image]

Shapes.AddOLEObject Method (Publisher)
Send feedback

Adds a new Shape object representing an OLE object to the specified Shapes collection.

Syntax

expression .AddOLEObject(Left, Top, Width, Height, ClassName, Filename, Link)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
Left | Required | Variant | The position of the left edge of the shape representing the OLE object.
Top | Required | Variant | The position of the top edge of the shape representing the OLE object.
Width | Optional | Variant | The width of the shape representing the OLE object. Default is -1, meaning that the width of the shape is automatically set based on the object's data.
Height | Optional | Variant | The height of the shape representing the OLE object. Default is -1, meaning that the width of the shape is automatically set based on the object's data.
ClassName | Optional | String | The class name of the OLE object to be added.
Filename | Optional | String | The file name of the OLE object to be added. If the path is not specified, the current working folder is used.
Link | Optional | MsoTriState | Determines whether the OLE object is linked to or embedded in the publication.

Return Value

Shape

Remarks

For the Left, Top, Width, and Height arguments, numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

You must specify either a ClassName or FileName. If neither argument is specified, or if both are specified, an error occurs.

The Link parameter can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The OLE object is embedded.
msoTrue | The OLE object is linked. The default.

Example

The following example adds a Microsoft Office Excel worksheet to the first page of the active publication and activates the worksheet for editing.

VBA Copy code Copy code
Dim shpSheet As Shape

Set shpSheet = ActiveDocument.Pages(1).Shapes.AddOLEObject _
 (Left:=72, Top:=72, ClassName:="Excel.Sheet")

shpSheet.OLEFormat.Activate


ColorScheme.Parent Property (Publisher)

 Copy code hover
[image]

ColorScheme.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a ColorScheme object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


MailMergeMappedDataField.Index Property (Publisher)

 Copy code hover
[image]

MailMergeMappedDataField.Index Property (Publisher)
Send feedback

Returns a Long that represents the position of a particular item in a specified collection. .

Syntax

expression .Index

expression A variable that represents a MailMergeMappedDataField object.

Example

The following example loops through the MailMergeDataFields collection and displays the Index and Name properties for each field.

Copy code Copy code
Dim mmfLoop As MailMergeDataField

With ActiveDocument.MailMerge.DataSource
 If .DataFields.Count > 0 Then
 For Each mmfLoop In .DataFields
 Debug.Print "Field " & mmfLoop.Name _
 & " / Index " & mmfLoop.Index
 Next mmfLoop
 Else
 Debug.Print "No fields to report."
 End If
End With

The following example loops through the Plates collection and displays the Index and Name properties for each plate.

VBA Copy code Copy code
Dim plaLoop As Plate

If ActiveDocument.Plates.Count > 0 Then
 For Each plaLoop In ActiveDocument.Plates
 Debug.Print "Plate " & plaLoop.Name _
 & " / Index " & plaLoop.Index
 Next plaLoop
Else
 Debug.Print "No plates to report."
End If


CaptionStyles.Count Property (Publisher)

 Copy code hover
[image]

CaptionStyles.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection. Read-only.

Syntax

expression .Count

expression A variable that represents a CaptionStyles object.


LineFormat.Application Property (Publisher)

 Copy code hover
[image]

LineFormat.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a LineFormat object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


MailMergeFilters Members (Publisher)

 Copy code hover
[image]

MailMergeFilters Members (Publisher)
Send feedback

Represents all the filters to apply to the data source attached to the mail merge or catalog merge publication. The MailMergeFilters object is composed of MailMergeFilterCriterion objects.

Methods

Name | Description
Add | Adds a new filter criterion to the specified MailMergeFilters object.
Delete | Deletes the specified object.
Item | Returns an individual object in a specified collection.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Creator | Returns a Long that represents the application in which the specified object was created. For example, if the object was created in Microsoft Publisher, this property returns the hexadecimal number 4D505542, which represents the string "MSPB." This value can also be represented by the constant.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Font.Tracking Property (Publisher)

 Copy code hover
[image]

Font.Tracking Property (Publisher)
Send feedback

Returns or sets a Variant indicating the tracking value used to display space between the characters in the specified text range. Read/write.

Syntax

expression .Tracking

expression A variable that represents a Font object.

Remarks

Valid range is 0.0 to 600.0 points. Setting the property to 0.0 disables tracking. Indeterminate values are returned as -2.

Example

This example disables tracking in the second story by setting the Tracking property to zero.

Copy code Copy code
Sub DisableTracking()

 Application.ActiveDocument.Stories(2).TextRange.Font.Tracking = 0.0

End Sub


ReflectionFormat Object (Publisher)

 Copy code hover
[image]

ReflectionFormat Object (Publisher)
See also Send feedback

Represents the reflection formatting for a shape or range of shapes.

Version Information

Version Added: Publisher 2013

See also

Other resources

ReflectionFormat Object Members


Story.TextRange Property (Publisher)

 Copy code hover
[image]

Story.TextRange Property (Publisher)
Send feedback

Returns a TextRange object that represents the text that is attached to a shape and properties and methods for manipulating the text.

Syntax

expression .TextRange

expression A variable that represents a Story object.

Example

The following example adds text to the text frame of shape one in the active publication, and then formats the new text. This example assumes there is at least one shape on the first page of the active publication.

Copy code Copy code
Sub AddTextToTextFrame()
 With ActiveDocument.Pages(1).TextFrame.TextRange
 .Text = "My Text"
 With .Font
 .Bold = msoTrue
 .Size = 25
 .Name = "Arial"
 End With
 End With
End Sub

The following example adds a rectangle to the active publication and adds text to it.

Copy code Copy code
Sub AddTextToShape()
 With ActiveDocument.Pages(1).Shapes.AddShape(Type:=msoShapeRectangle, _
 Left:=72, Top:=72, Width:=250, Height:=140)
 .TextFrame.TextRange.Text = "Here is some test text"
 End With
End Sub


TextEffectFormat.FontName Property (Publisher)

 Copy code hover
[image]

TextEffectFormat.FontName Property (Publisher)
Send feedback

Sets or returns a String that represents the name of the font applied to a dropped capital letter or WordArt text effect. Read/write.

Syntax

expression .FontName

expression A variable that represents a TextEffectFormat object.


MailMergeDataSource.InvalidAddress Property (Publisher)

 Copy code hover
[image]

MailMergeDataSource.InvalidAddress Property (Publisher)
Send feedback

True to mark a record in a mail merge data source if it contains invalid data. Read/write Boolean.

Syntax

expression .InvalidAddress

expression A variable that represents an MailMergeDataSource object.

Return Value

Boolean

Remarks

Use the SetAllErrorFlags method to set both the InvalidAddress and InvalidComments properties for all records in a data source.

Example

This example searches the records to verify that the length of the PostalCode field for each record is at least five digits long. If it is not, the record is excluded from the mail merge and flagged as invalid.

Copy code Copy code
Sub ExcludeRecords()
 Dim intRecord As Integer
 With ActiveDocument.MailMerge
 For intRecord = 1 To .DataSource.RecordCount
 .DataSource.ActiveRecord = intRecord
 If Len(.DataSource.DataFields("PostalCode").Value) < 5 Then
 With .DataSource
 .Included = False
 .InvalidAddress = True
 .InvalidComments = "This record is removed " & _
 "from the mail merge because its postal code" & _
 "has less than five digits."
 End With
 End If
 Next
 End With
End Sub


WebHiddenFields Properties (Publisher)

 Copy code hover
[image]

WebHiddenFields Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


WizardValues Members (Publisher)

 Copy code hover
[image]

WizardValues Members (Publisher)
Send feedback

Represents the complete set of valid values for a wizard property.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Item | Returns an individual object from a specified collection. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Font.Shrink Method (Publisher)

 Copy code hover
[image]

Font.Shrink Method (Publisher)
Send feedback

Decreases the font size to the next available size. If the selection or range contains more than one font size, each size is decreased to the next available setting.

Syntax

expression .Shrink

expression A variable that represents a Font object.

Remarks

Applying the Shrink method to text that is already the smallest size allowed by Microsoft Publisher (0.5 point) has no effect.

Example

This example inserts a line of increasingly smaller Z's in a new document.

Copy code Copy code
Dim shpText As Shape
Dim trTemp As TextRange
Dim intCount As Integer

Set shpText = ActiveDocument.Pages(1).Shapes _
 .AddTextbox(Orientation:=pbTextOrientationHorizontal, _
 Left:=100, Top:=100, Width:=300, Height:=50)

Set trTemp = shpText.TextFrame.TextRange

With trTemp
 .Font.Size = 45
 .InsertAfter NewText:="ZZZZZZZZZZ"
 For intCount = 2 To 10
 .Characters(Start:=intCount, _
 Length:=11 - intCount).Font.Shrink
 Next intCount
End With


TextRange.Font Property (Publisher)

 Copy code hover
[image]

TextRange.Font Property (Publisher)
Send feedback

Sets or returns a Font object that represents character formatting attributes applied to the specified object. Read/write.

Syntax

expression .Font

expression A variable that represents a TextRange object.

Example

This example selects text and formats the font as bold.

Copy code Copy code
Sub test2()
 With Selection.TextRange
 .Start = 50
 .End = 150
 .Font.Bold = msoTrue
 End With
End Sub


Application.ActiveDocument Property (Publisher)

 Copy code hover
[image]

Application.ActiveDocument Property (Publisher)
See also Send feedback

Returns a Document object that represents the active publication. If there are no documents open, an error occurs.

Syntax

expression .ActiveDocument

expression A variable that represents an Application object.

Return Value

Document

Example

This example allows the user to assign a file name to the active publication and save it with the new file name. The file name, along with other text, is then inserted after the currently selected text. (Note that Filename must be replaced with a valid publication name for this example to work.)

Copy code Copy code
Sub NewsLetterSave()

 Dim strFileName As String

 ' Assign the explicit file name to a variable.
 strFileName = "Filename"
 Publisher.ActiveDocument.SaveAs strFileName

 ' Insert the file name and supporting text after selected text.
 Selection.TextRange.Collapse pbCollapseEnd
 Selection.TextRange = _
 " This publication has been saved as " & strFileName

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


ConnectorFormat.Parent Property (Publisher)

 Copy code hover
[image]

ConnectorFormat.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a ConnectorFormat object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


MailMergeDataField Methods (Publisher)

 Copy code hover
[image]

MailMergeDataField Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
AddToRecipientFields | Adds the parent MailMergeDataField object from a particular data source to the master data source (collection of data fields) for a mail-merge publication.
Insert | Returns a Shape object that represents a data field inserted into a publication.
MapToRecipientField | Maps a field (column) in a particular data source represented by the parent MailMergeDataField object to a recipient field (column) in the master data source (combined mail-merge recipient list).
UnMapRecipientField | Undoes the mapping between the parent MailMergeDataField object in a particular data source and the recipient field in the master data source (combined mail-merge recipient list) to which it is currently mapped.


DropCap.Size Property (Publisher)

 Copy code hover
[image]

DropCap.Size Property (Publisher)
Send feedback

Returns or sets a Long that represents the number of lines high to format a dropped capital letter. Read/write.

Syntax

expression .Size

expression A variable that represents a DropCap object.

Example

This example formats a drop cap for the specified text range that is five lines high.

VBA Copy code Copy code
Sub RaisedDropCap()
 Dim intCount As Integer
 With ActiveDocument.Pages(1).Shapes _
 .AddTextbox(Orientation:=pbTextOrientationHorizontal, _
 Left:=100, Top:=100, Width:=100, Height:=100) _
 .TextFrame.TextRange
 For intCount = 1 To 10
 .InsertAfter NewText:="This is a test. "
 Next intCount
 With .DropCap
 .Size = 5
 .LinesUp = 2
 End With
 End With
End Sub


WebNavigationBarSet.ShowSelected Property (Publisher)

 Copy code hover
[image]

WebNavigationBarSet.ShowSelected Property (Publisher)
Send feedback

True if the selected button is highlighted for the specified WebNavigationBarSet object. Read/write Boolean.

Syntax

expression .ShowSelected

expression A variable that represents a WebNavigationBarSet object.

Return Value

Boolean

Example

The following example adds a new Web navigation bar to the active document, adds it to every page, and then sets the ShowSelected property to False so that the selected button will not be highlighted in the navigation bar.

VBA Copy code Copy code
Dim objWebNav As WebNavigationBarSet
Set objWebNav = ActiveDocument.WebNavigationBarSets.AddSet(Name:="newNavBar")
With objWebNav
 .AddToEveryPage Left:=10, Top:=10
 .ButtonStyle = pbnbButtonStyleSmall
 .ShowSelected = False
End With


WebTextBox.Parent Property (Publisher)

 Copy code hover
[image]

WebTextBox.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a WebTextBox object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


TextStyles.Count Property (Publisher)

 Copy code hover
[image]

TextStyles.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a TextStyles object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


PbTextAutoFitType Enumeration (Publisher)

 Copy code hover
[image]

PbTextAutoFitType Enumeration (Publisher)
Send feedback

Represents how Microsoft Publisher automatically adjusts the text font size and the TextFrame objects size for best viewing.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbTextAutoFitBestFit | 2 | Text frame size adjusts to fit text.
pbTextAutoFitNone | 0 | Allows text to overflow the text frame.
pbTextAutoFitShrinkOnOverflow | 1 | Text font reduces so text fits within the text frame.


WizardProperty.Enabled Property (Publisher)

 Copy code hover
[image]

WizardProperty.Enabled Property (Publisher)
Send feedback

True if a wizard property is enabled. Read-only Boolean.

Syntax

expression .Enabled

expression A variable that represents an WizardProperty object.

Return Value

Boolean

Example

This example displays the name of each enabled wizard property in the active publication.

Copy code Copy code
Sub SetEnabledProperty()
 Dim wizProperty As WizardProperty
 For Each wizProperty In ActiveDocument.Wizard.Properties
 If wizProperty.Enabled = True Then
 MsgBox "The name of the wizard property is " & wizProperty.Name
 End If
 Next
End Sub


ShapeRange Object (Publisher)

 Copy code hover
[image]

ShapeRange Object (Publisher)
Send feedback

Represents a shape range, which is a set of shapes on a document. A shape range can contain as few as one shape or as many as all the shapes in the document. You can include whichever shapes you want — chosen from among all the shapes in the document or all the shapes in the selection — to construct a shape range. For example, you could construct a ShapeRange collection that contains the first three shapes in a document, all the selected shapes in a document, or all the freeform shapes in a document.

Note Note

Most operations that you can do with a Shape object, you can also do with a ShapeRange object that contains only one shape. Some operations, when performed on a ShapeRange object that contains more than one shape, will cause an error. This section describes how to:

  • Return a set of shapes.

  • Return a ShapeRange object within a selection or range.

  • Align, distribute, and group shapes in a ShapeRange object.

Example

Use Shapes.Range(index), where index is the index number of the shape or an array that contains index numbers of shapes, to return a ShapeRange collection that represents a set of shapes in a publication. You can use Visual Basic's Array function to construct an array of index numbers. The following example sets the fill pattern for shapes one through three on the active publication.

Copy code Copy code
Sub ChangeFillPattern()
    ActiveDocument.Pages(1).Shapes.Range(Array(1, 2, 3)) _
        .Fill.PresetGradient Style:=msoGradientDiagonalDown, _
        Variant:=1, PresetGradientType:=msoGradientHorizon
End Sub

Although you can use the Range method to return any number of shapes, it is simpler to use the Item method if you want to return only a single member of the collection. For example, Shapes(1) is simpler than Shapes.Range(1).

Use Selection.ShapeRange(index), where index is the index number of the shape, to return a Shape object that represents a shape within a selection. The following example selects the first two shapes on the first page of the active publication and then sets the fill for the first shape in the selection.

Copy code Copy code
Sub ChangeFillForShapeRange()
    ActiveDocument.Pages(1).Shapes.Range(Array(1, 2)).Select
    Selection.ShapeRange(1).Fill.ForeColor.RGB = RGB(255, 0, 0)
End Sub

This example selects all the shapes on the first page of the active publication, then adds and formats text in the second shape in the range.

Copy code Copy code
Sub SelectShapesOnPageOne()
    ActiveDocument.Pages(1).Shapes.Range.Select
    With Selection.ShapeRange(2).TextFrame.TextRange
        .Text = "Shape Number 2"
        .ParagraphFormat.Alignment = pbParagraphAlignmentCenter
        .Font.Size = 25
    End With
End Sub

Use the Align , Distribute , or ZOrder method to position a set of shapes relative to each other or relative to the document. This example specifies a shape range and left-aligns and vertically distributes the shapes on the page.

Copy code Copy code
Sub AlignDistibuteShapes()
    Dim rngShapes As ShapeRange
    Set rngShapes = ActiveDocument.Pages(1).Shapes.Range

    With rngShapes
        .Align AlignCmd:=msoAlignLefts, RelativeTo:=msoFalse
        .Distribute DistributeCmd:=msoDistributeVertically, RelativeTo:=msoTrue
    End With
End Sub

Use the Group , Regroup , or Ungroup method to create and work with a single shape formed from a shape range. The GroupItems property for a Shape object returns the GroupShapes object, which represents all the shapes that were grouped to form one shape. This example specifies a shape range and left-aligns and vertically distributes the shapes on the page.

Copy code Copy code
Sub GroupShapes()
    Dim rngShapes As ShapeRange
    Set rngShapes = ActiveDocument.Pages(1).Shapes.Range
    rngShapes.Group

    rngShapes(1).Fill.OneColorGradient _
        Style:=msoGradientFromCenter, _
        Variant:=2, Degree:=1
End Sub


MailMergeDataSource.Close Method (Publisher)

 Copy code hover
[image]

MailMergeDataSource.Close Method (Publisher)
Send feedback

Closes the specified mail merge data source, cancels the mail merge, and converts all mail merge data fields to plain text.

Syntax

expression .Close

expression A variable that represents a MailMergeDataSource object.

Remarks

Closing a mail merge data source deletes the shape that represents the catalog merge area of the publication page associated with the data source.

Example

The following example closes the data source for the active mail merge publication.

VBA Copy code Copy code
ActiveDocument.MailMerge.DataSource.Close


LineFormat.DashStyle Property (Publisher)

 Copy code hover
[image]

LineFormat.DashStyle Property (Publisher)
Send feedback

Returns or sets an MsoLineDashStyle constant indicating the dash style for the specified line. Read/write.

Syntax

expression .DashStyle

expression A variable that represents a LineFormat object.

Return Value

MsoLineDashStyle

Remarks

The DashStyle property value can be one of the MsoLineDashStyle constants declared in the Microsoft Office type library.

Example

This example adds a blue dashed line to the active publication.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes _
 .AddLine(BeginX:=10, BeginY:=10, _
 EndX:=250, EndY:=250).Line
 .DashStyle = msoLineDashDotDot
 .ForeColor.RGB = RGB(50, 0, 128)
End With


WebHiddenFields.Add Method (Publisher)

 Copy code hover
[image]

WebHiddenFields.Add Method (Publisher)
Send feedback

Adds a new hidden field to a Web form and returns a Long indicating the number of the new field in the WebHiddenFields collection. New fields are always placed at the end of the current field list.

Syntax

expression .Add(Name, Value)

expression A variable that represents a WebHiddenFields object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the new field.
Value | Required | String | The value of the new field.

Return Value

Long

Example

The following example adds a new hidden field to the specified Web command button control. Shape one on page one of the active publication must be a Web command button control for this example to work.

VBA Copy code Copy code
ActiveDocument.Pages(1).Shapes(1) _
 .WebCommandButton.HiddenFields _
 .Add Name:="subject", Value:="service request"


CellRange.Height Property (Publisher)

 Copy code hover
[image]

CellRange.Height Property (Publisher)
Send feedback

Returns a Long that represent the height (in cells) of a table, range of cells, or page. Read-only.

Syntax

expression .Height

expression A variable that represents a CellRange object.

Remarks

The valid range for the Height property depends on the size of the application workspace and the position of the object within the workspace. For centered objects on non-banner page sizes, the Height property may be 0.0 to 50.0 cells. For centered objects on banner page sizes, the Height property may be 0.0 to 241.0 cells.


AdvancedPrintOptions.PrintJobInformation Property (Publisher)

 Copy code hover
[image]

AdvancedPrintOptions.PrintJobInformation Property (Publisher)
See also Send feedback

True to print information about the print job on each plate. The default is True. Read/write Boolean.

Syntax

expression .PrintJobInformation

expression A variable that represents a AdvancedPrintOptions object.

Return Value

Boolean

Remarks

The PrintJobInformation property can be set regardless of the print mode selected for the publication. However, it is ignored (and no job information is printed) when the print mode is set as composite RGB.

Job information includes the file name of the printed publication, the date it was printed, the page number, and which color ink the plate is for (cyan, magenta, yellow, black, or a spot color).

This property corresponds to the Job information control on the Page Settings tab of the Advanced Print Settings dialog box.

These printer's marks print outside the publication and can be printed only if the size of the paper being printed to is larger than the publication page size.

Example

The following example sets crop marks and job information to print with the publication. If the publication is printed as separations, the additional types of printer's marks are also set to print. This example assumes that the size of the paper being printed to is larger than the publication page size.

VBA Copy code Copy code
Sub SetPrintersMarksToPrint()
 With ActiveDocument.AdvancedPrintOptions
 .PrintCropMarks = True
 .PrintJobInformation = True
 If PrintMode = pbPrintModeSeparations Then
 .PrintRegistrationMarks = True
 .PrintDensityBars = True
 .PrintColorBars = True
 End If
 End With
End Sub

See also

Concepts

AdvancedPrintOptions Object

Other resources

AdvancedPrintOptions Object Members


ColorFormat.BaseRGB Property (Publisher)

 Copy code hover
[image]

ColorFormat.BaseRGB Property (Publisher)
Send feedback

Returns or sets an MsoRGBType constant that represents the original RGB color format before color-changing properties, such as tinting and shading, are applied. Read/write.

Syntax

expression .BaseRGB

expression A variable that represents a ColorFormat object.

Return Value

MsoRGBType

Example

This example creates a shape, sets the fill color and lightens the color; then it creates a second shape and applies the original RGB color of the first shape to the second shape.

Copy code Copy code
Sub SetBaseRGB()
 Dim shpOne As Shape

 With ActiveDocument.Pages(1).Shapes
 Set shpOne = .AddShape(Type:=msoShapeHeart, _
 Left:=150, Top:=150, Width:=300, Height:=300)
 With shpOne.Fill.ForeColor
 .RGB = RGB(Red:=160, Green:=0, Blue:=255)
 .TintAndShade = 0.9
 End With
 .AddShape(Type:=msoShapeRectangle, Left:=62, _
 Top:=500, Width:=488, Height:=100).Fill _
 .ForeColor.RGB = shpOne.Fill.ForeColor.BaseRGB
 End With
End Sub


ShapeRange.Group Method (Publisher)

 Copy code hover
[image]

ShapeRange.Group Method (Publisher)
Send feedback

Groups the shapes in the specified shape range. Returns the grouped shapes as a single Shape object.

Syntax

expression .Group

expression A variable that represents a ShapeRange object.

Return Value

Shape

Remarks

The specified range must contain more than one shape, or an error occurs.

Because a group of shapes is treated as a single shape, grouping and ungrouping shapes changes the number of items in the Shapes collection and changes the index numbers of items that come after the affected items in the collection.

Example

This example adds two shapes to the first page of the active publication, groups the two new shapes, sets the fill for the group, rotates the group, and sends the group to the back of the drawing layer.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes

 ' Add two shapes to the page.
 .AddShape(Type:=msoShapeCan, _
 Left:=50, Top:=10, Width:=100, Height:=200).Name = "shpOne"
 .AddShape(Type:=msoShapeCube, _
 Left:=150, Top:=250, Width:=100, Height:=200).Name = "shpTwo"

 ' Group the shapes and change the formatting for the whole group.
 With .Range(Index:=Array("shpOne", "shpTwo")).Group
 .Fill.PresetTextured PresetTexture:=msoTextureBlueTissuePaper
 .Rotation = 45
 .ZOrder ZOrderCmd:=msoSendToBack
 End With

End With


WebPageOptions.Application Property (Publisher)

 Copy code hover
[image]

WebPageOptions.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a WebPageOptions object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


WebOptions Members (Publisher)

 Copy code hover
[image]

WebOptions Members (Publisher)
Send feedback

Represents the properties of a Web publication, including options for saving and encoding the publication, and enabling Web-safe fonts and font schemes. The WebOptions object is a member of the Application object.

Properties

Name | Description
AlwaysSaveInDefaultEncoding | Returns or sets a Boolean value that specifies whether Web pages within a Web publication should always be saved using default encoding. If True, Web pages within a publication will always be saved using the default encoding of the client computer. If False, Web pages will not be saved using default encoding. The default value is False. Read/write.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
EmailAsImg | True to send the entire publication page as a single JPEG image. Read/write Boolean.
EnableIncrementalUpload | Returns or sets a Boolean value that specifies whether changes made to a Web publication can be uploaded to a Web server independent of the entire publication. If True, only changes made to a publication will be uploaded to the Web server when published. If False, the entire publication will be uploaded to the Web server. The default value is True. Read/write.
Encoding | Returns an MsoEncoding constant that specifies the encoding of the Web publication. Read/write.
OrganizeInFolder | Returns or sets a Boolean value that specifies whether a Web publication will be saved in a flat structure or hierarchical structure. If False, all files in the Web publication will be saved in a flat structure within the root folder. If True, the files will be saved in a hierarchical structure within the root folder. The default value is True. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
RelyOnVML | Returns or sets a Boolean value that specifies whether image files are generated from drawing objects when a Web publication is saved. If True, image files are not generated. If False, images are generated. The default value is False. Read/write.
ShowOnlyWebFonts | Returns or sets a Boolean value that specifies whether only Web-safe fonts and font schemes should be used when the Web site is viewed in a browser. If True, only Web-safe fonts and font schemes are used. If False, display is not limited to Web-safe fonts and font schemes. The default value is False. Read/write.


PbNavBarOrientation Enumeration (Publisher)

 Copy code hover
[image]

PbNavBarOrientation Enumeration (Publisher)
Send feedback

Represents the alignment of the navigation bar; vertical or horizontal.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbNavBarOrientHorizontal | 1 | Horizontal orientation
pbNavBarOrientVertical | 2 | Vertical orientation


Application.Parent Property (Publisher)

 Copy code hover
[image]

Application.Parent Property (Publisher)
See also Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents an Application object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


PbLigaturePresetType Enumeration (Publisher)

 Copy code hover
[image]

PbLigaturePresetType Enumeration (Publisher)
Send feedback

Constants passed to and returned by the Font.Ligature property, specifying the state of the Ligature property on the characters in a text range.

Version Information

Version Added: Publisher 2010

Name | Value | Description
pbLigatureAll | 3 | Ligature applied to all characters
pbLigatureMixed | -1 | Ligature applied to some characters, but not others
pbLigatureNone | 4 | No ligature applied
pbLigatureStandard | 0 | Standard ligature applied
pbLigatureStandardHistorical | 2 | Standard historical ligature applied
pbLigatureStandardOptional | 1 | Standard optional ligature applied


Application.PointsToEmus Method (Publisher)

 Copy code hover
[image]

Application.PointsToEmus Method (Publisher)
See also Send feedback

Converts a measurement from points to emus (12700 emus = 1 point). Returns the converted measurement as a Single.

Syntax

expression .PointsToEmus(Value)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Value | Required | Single | The point value to be converted to emus.

Return Value

Single

Remarks

Use the EmusToPoints method to convert measurements in emus to points.

Example

This example converts measurements in points entered by the user to measurements in centimeters.

Copy code Copy code
Dim strInput As String
Dim strOutput As String

Do While True
 ' Get input from user.
 strInput = InputBox( _
 Prompt:="Enter measurement in points (0 to cancel): ", _
 Default:="0")

 ' Exit the loop if user enters zero.
 If Val(strInput) = 0 Then Exit Do

 ' Evaluate and display result.
 strOutput = Trim(strInput) & " points = " _
 & Format(Application _
 .PointsToEmus(Value:=Val(strInput)), _
 "0.00") & " emus"

 MsgBox strOutput
Loop

See also

Concepts

Application Object

Other resources

Application Object Members


PbDirectionType Enumeration (Publisher)

 Copy code hover
[image]

PbDirectionType Enumeration (Publisher)
Send feedback

Represents a global Microsoft Publisher option, indicating whether text flows from left to right or from right to left in a publication.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbDirectionLeftToRight | 1 | Left to Right
pbDirectionRightToLeft | 2 | Right to Left


ParagraphFormat.LineSpacing Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.LineSpacing Property (Publisher)
Send feedback

Returns or sets a Variant that represents the line spacing (in number of lines) for the specified paragraphs. Read/write.

Syntax

expression .LineSpacing

expression A variable that represents a ParagraphFormat object.

Return Value

Variant

Remarks

You can use the LineSpacingRule property to set the line spacing to a preset value.

Example

This example sets the line spacing of the paragraph at the cursor position to three lines. This example assumes the cursor is in a text box.

Copy code Copy code
Sub SetLineSpacing()
 Selection.TextRange.ParagraphFormat.LineSpacing = 3
End Sub


Page.Width Property (Publisher)

 Copy code hover
[image]

Page.Width Property (Publisher)
Send feedback

Returns a Long that represent the width (in points) of a cell, range of cells, or page. Read-only.

Syntax

expression .Width

expression A variable that represents a Page object.


TextEffectFormat Methods (Publisher)

 Copy code hover
[image]

TextEffectFormat Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
ToggleVerticalText | Switches the text flow in the specified WordArt from horizontal to vertical, or vice versa.


ShapeRange.VerticalFlip Property (Publisher)

 Copy code hover
[image]

ShapeRange.VerticalFlip Property (Publisher)
Send feedback

Returns msoTrue if the specified shape has been flipped around its vertical axis. Read-only.

Syntax

expression .VerticalFlip

expression A variable that represents a ShapeRange object.

Remarks

The VerticalFlip property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The shape has not been flipped around its vertical axis.
msoTriStateMixed | Return value indicating a combination of msoTrue and msoFalse for the specified shape range.
msoTriStateToggle | Set value that switches between msoTrue and msoFalse.
msoTrue | The shape has been flipped around its vertical axis.

Example

This example restores each shape on the active publication to its original state if it has been flipped horizontally or vertically.

VBA Copy code Copy code
Sub Flipper()

 Dim shpBall As Shape

 For Each shpBall In ActiveDocument.MasterPages.Item(1).Shapes
 If shpBall.HorizontalFlip = msoTrue Then shpBall.Flip msoFlipHorizontal
 If shpBall.VerticalFlip = msoTrue Then shpBall.Flip msoFlipVertical
 Next

End Sub


PageSize.VerticalGap Property (Publisher)

 Copy code hover
[image]

PageSize.VerticalGap Property (Publisher)
Send feedback

Returns a Variant that represents the distance in points between the bottom edge of one publication page and top edge of the publication page immediately below it for the blank page size represented by the parent PageSize object. This property applies only when multiple pages are printed on a single sheet of printer paper. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .VerticalGap

expression A variable that represents a PageSize object.

Return Value

Variant

Remarks

The blank page size represented by the parent PageSize object corresponds to one of the icons displayed under Blank Page Sizes in the Page Setup dialog box in the Microsoft Publisher user interface.

Numeric values are evaluated as points. String values can be in any unit supported by Microsoft Publisher (for example, "2.5 in"). The valid range of possible values is from zero to the difference between the sheet height and the page height.


Wizard Members (Publisher)

 Copy code hover
[image]

Wizard Members (Publisher)
Send feedback

Represents the publication design associated with a publication or the wizard associated with a Design Gallery object.

Methods

Name | Description
SetId | Specifies the type of the wizard (template) to which to convert the current publication type.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
ID | Returns a Long that represents the type of a shape, range of shapes, or property, type, or value of a wizard. Read-only.
Name | Returns a String value indicating the name of the specified object. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Properties | Returns a WizardProperties collection representing all the settings that are part of the specified publication design or Design Gallery object's wizard.


Page Properties (Publisher)

 Copy code hover
[image]

Page Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Background | Sets or returns a PageBackground object representing the background of the specified page.
Footer | Returns a HeaderFooter object representing the footer of the specified Page object. Read-only.
Header | Returns a HeaderFooter object representing the header of the specified Page object. Read-only.
Height | Returns a Long that represent the height (in points) of a cell, range of cells, or page. Read-only.
IgnoreMaster | True for Microsoft Publisher to ignore the master page formatting for the specified page. Read/write Boolean.
IsLeading | True if the specified Page object is a leading page of a two-page spread. Read-only Boolean.
IsTrailing | True if the specified Page object is a trailing page of a two-page spread. Read-only Boolean.
IsTwoPageMaster | True if the specified Page object is a two-page master. Read/write Boolean.
IsWizardPage | Returns True if the specified page is a Microsoft Publisher wizard page. Read-only Boolean.
LayoutGuides | Returns a LayoutGuides object consisting of the margin and grid layout guides for all pages including master pages in the publication.
Master | Sets or returns a Page object that represents the master page properties for the specified page.
Name | Returns or sets a String value indicating the name of the specified object. Read/write.
PageID | Returns a Long indicating the unique identifier for a page in a publication. Read-only.
PageIndex | Gets the index of the page in the Pages collection of the active document. Read-only.
PageNumber | Returns a String that represents the current page number. Read-only.
PageType | Returns a PbPageType constant that represents the page type. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
ReaderSpread | Returns a ReaderSpread object that represents the reader spread of the specified page.
RulerGuides | Returns a RulerGuides collection that represents gridlines used to align objects on a page.
Shapes | Returns a Shapes collection that represents all the Shape objects in the specified publication. This collection can contain drawings, shapes, pictures, OLE objects, ActiveX controls, text objects, and callouts.
Tags | Returns a Tags collection representing tags or custom properties applied to a shape, shape range, page, or publication.
WebPageOptions | Returns a WebPageOptions object, which represents the properties of a single Web page within a Web publication. Read-only.
Width | Returns a Long that represent the width (in points) of a cell, range of cells, or page. Read-only.
Wizard | Returns a Wizard object representing the publication design associated with the specified publication or the wizard associated with the specified Design Gallery object.
XOffsetWithinReaderSpread | Returns a Single that represents the distance (in points) from the left edge of the reader spread to the left edge of the page. Read-only.
YOffsetWithinReaderSpread | Returns a Single that represents the distance (in points) from the top edge of the reader spread to the top edge of the page. Read-only.


WebListBox.MultiSelect Property (Publisher)

 Copy code hover
[image]

WebListBox.MultiSelect Property (Publisher)
Send feedback

Specifies whether a user may select more than one item in a Web list box control. Read/write.

Syntax

expression .MultiSelect

expression A variable that represents a WebListBox object.

Return Value

MsoTriState

Remarks

The MultiSelect property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | Indicates a user may only select one item in a Web list box control.
msoTrue | Indicates a user may select more than one item in a Web list box control.

Example

This example add a Web list box control to the active publication, add items to it, and specifies that a user may select more than one item.

VBA Copy code Copy code
Sub NewListBoxItems()
 Dim intCount As Integer
 With ActiveDocument.Pages(1).Shapes.AddWebControl _
 (Type:=pbWebControlListBox, Left:=100, _
 Top:=100, Width:=150, Height:=100).WebListBox
 .MultiSelect = msoTrue
 With .ListBoxItems
 For intCount = 1 To .Count
 .Delete (1)
 Next
 .AddItem Item:="Yellow"
 .AddItem Item:="Red"
 .AddItem Item:="Blue"
 .AddItem Item:="Green"
 .AddItem Item:="Black"
 End With
 End With
End Sub


MailMergeDataField.Parent Property (Publisher)

 Copy code hover
[image]

MailMergeDataField.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a MailMergeDataField object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


PbWebControlType Enumeration (Publisher)

 Copy code hover
[image]

PbWebControlType Enumeration (Publisher)
Send feedback

Specifies the type of Web form control to add.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbWebControlCheckBox | 100 | Adds a check box.
pbWebControlCommandButton | 101 | Adds a command button.
pbWebControlHotSpot | 110 | Adds a hot spot.
pbWebControlHTMLFragment | 107 | Adds an HTML fragment.
pbWebControlListBox | 102 | Adds a list box.
pbWebControlMultiLineTextBox | 103 | Adds a multiple-line text area.
pbWebControlOptionButton | 104 | Adds an option button.
pbWebControlSingleLineTextBox | 105 | Adds a single-line text box.
pbWebControlWebComponent | 106 | Adds a single-line Web component.


ColorSchemes.Count Property (Publisher)

 Copy code hover
[image]

ColorSchemes.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a ColorSchemes object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


MailMerge.Type Property (Publisher)

 Copy code hover
[image]

MailMerge.Type Property (Publisher)
Send feedback

Gets or sets the type of mail merge represented by the parent MailMerge object. Read/write.

Version Information

Version Added: Publisher 2007

Syntax

expression .Type

expression An expression that returns a MailMerge object.

Return Value

PbMergeType

Remarks

Possible values for the Type property are declared in the PbMergeType enumeration and shown in the following table.

Constant | Value | Description
pbCatalogMerge | 3 | Catalog merge
pbEmailMerge | 4 | E-mail merge
pbMailMerge | 2 | Mail merge
pbMergeDefault | 0 | Default merge


TextFrame.VerticalTextAlignment Property (Publisher)

 Copy code hover
[image]

TextFrame.VerticalTextAlignment Property (Publisher)
Send feedback

Returns or sets a PbVerticalTextAlignmentType constant that represents the vertical alignment of text in a text box. Read/write.

Syntax

expression .VerticalTextAlignment

expression A variable that represents a TextFrame object.

Remarks

The VerticalTextAlignment property value can be one of these PbVerticalTextAlignmentType constants.

pbVerticalTextAlignmentBottom

pbVerticalTextAlignmentCenter

pbVerticalTextAlignmentTop

Example

This example vertically centers the text in the specified text frame. This example assumes there is at least one shape on the first page of the active publication.

VBA Copy code Copy code
Sub SetVerticalAlignment()
 ActiveDocument.Pages(1).Shapes(1).TextFrame _
 .VerticalTextAlignment = pbVerticalTextAlignmentCenter
End Sub


Page.Name Property (Publisher)

 Copy code hover
[image]

Page.Name Property (Publisher)
Send feedback

Returns or sets a String value indicating the name of the specified object. Read/write.

Syntax

expression .Name

expression A variable that represents a Page object.

Remarks

You can use an object's name in conjunction with the Item method or Item property to return a reference to the object if the Item method or property for the collection that contains the object takes a Variant argument. For example, if the value of the Name property for a shape is Rectangle 2, then .Shapes("Rectangle 2") will return a reference to that shape.

The Name property is the default property for the BorderArt, BorderArtFormat, and Label objects.


AdvancedPrintOptions Properties (Publisher)

 Copy code hover
[image]

AdvancedPrintOptions Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
AllowBleeds | True to allow bleeds to print for the specified publication. The default is True. Read/write Boolean.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
BackSideInsertFaceUp | Gets or sets whether envelopes fed to the printer's manual feed should be inserted back-side first and face up. Read/write.
GraphicsResolution | Returns or sets a PbPrintGraphics constant representing the resolution at which the inserted graphics are to be printed in the specified publication. Read/write.
HorizontalFlip | True to print a horizontally mirrored image of the specified publication. The default is False. Read/write Boolean.
IsPostscriptPrinter | Returns True if the active printer is a PostScript printer. Read-only Boolean.
ManualFeedAlign | Gets or sets the alignment (left, right, or center) of where envelopes are fed to the printer's manual feed. Read/write.
ManualFeedDirection | Gets or sets the orientation (landscape or portrait) of how envelopes are fed to the printer's manual feed. Read/write.
NegativeImage | True to print a negative image of the specified publication. The default is False. Read/write Boolean.
PageRotated | Gets or sets whether the printed page is rotated 180 degrees. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
PrintBleedMarks | True to print bleed marks in the specified publication. The default is False. Read/write Boolean.
PrintCropMarks | True to print crop marks for the specified publication. The default is True. Read/write Boolean.
PrintDensityBars | True to print a density bar for the specified publication. The default is True. Read/write Boolean.
PrintJobInformation | True to print information about the print job on each plate. The default is True. Read/write Boolean.
PrintRegistrationMarks | True to print registration marks for the specified publication. The default is True. Read/write Boolean.
Resolution | Returns or sets a String that represents the resolution, in dots per inch (dpi), at which to print the specified publication. Default is dependent on the printer driver, but is usually "(default)". Read/write.
UseOnlyPublicationFonts | Returns or sets a Boolean that represents whether to only use publication fonts for printing the specified publication. True to print the specified publication using only fonts downloaded from your computer. Read/write. The default is True.
VerticalFlip | True to print a vertically mirrored image of the specified publication. The default is False. Read/write Boolean.


ShapeRange.Fill Property (Publisher)

 Copy code hover
[image]

ShapeRange.Fill Property (Publisher)
Send feedback

Returns a FillFormat object representing the fill for the specified shape or table cell.

Syntax

expression .Fill

expression A variable that represents a ShapeRange object.

Example

This example creates a new AutoShape object and fills the shape with green.

VBA Copy code Copy code
Sub NewShapeItem()

 Dim shpHeart As Shape

 Set shpHeart = ThisDocument.MasterPages.Item(1).Shapes _
 .AddShape(Type:=msoShapeHeart, Left:=40, Top:=80, _
 Width:=50, Height:=50)
 shpHeart.Fill.ForeColor.RGB = RGB(Red:=0, Green:=255, Blue:=0)

End Sub


Wizard.ID Property (Publisher)

 Copy code hover
[image]

Wizard.ID Property (Publisher)
Send feedback

Returns a Long that represents the type of a shape, range of shapes, or property, type, or value of a wizard. Read-only.

Syntax

expression .ID

expression A variable that represents a Wizard object.

Example

This example displays the type for each shape on the first page of the active publication.

Copy code Copy code
Sub ShapeID()
 Dim shp As Shape
 For Each shp In ActiveDocument.Pages(1).Shapes
 MsgBox shp.ID
 Next shp
End Sub


Section Members (Publisher)

 Copy code hover
[image]

Section Members (Publisher)
Send feedback

Represents a Section of a publication or document.

Methods

Name | Description
Delete | Deletes the specified object.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
ContinueNumbersFromPreviousSection | True if the specified section continues the numbering from the prvious section. Read/write Boolean.
PageNumberFormat | Sets or returns a PbPageNumberFormat constant that reperesents the formatting of the page numbering. Read/write.
PageNumberStart | Sets or returns the page number that the specified section starts with. Read/write Long.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
ShowHeaderFooterOnFirstPage | True if the header and footer of the specified section will be visible. Read/write Boolean.
StartPageIndex | Returns the page number of the page that the specified Section object begins on. Read-only.


WebNavigationBarSet.Name Property (Publisher)

 Copy code hover
[image]

WebNavigationBarSet.Name Property (Publisher)
Send feedback

Indicates the name of the specified Web navigation bar set. Read/write.

Syntax

expression .Name

expression An expression that returns a WebNavigationBarSet object.

Return Value

String


TextFrame Methods (Publisher)

 Copy code hover
[image]

TextFrame Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
BreakForwardLink | Breaks the forward link for the specified text frame, if such a link exists.
ValidLinkTarget | Determines whether the text frame of one shape can be linked to the text frame of another shape. Returns True if LinkTarget is a valid target, False if LinkTarget already contains text or is already linked, or if the shape does not support attached text.


Tag Properties (Publisher)

 Copy code hover
[image]

Tag Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Name | Returns a String value indicating the name of the specified object. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Value | Returns or sets a Variant that represents the value of a tag of a shape, page, or publication. Read/write.


ShapeRange.Connector Property (Publisher)

 Copy code hover
[image]

ShapeRange.Connector Property (Publisher)
Send feedback

Returns an MsoTriState value indicating whether the specified shape is a connector. Read-only.

Syntax

expression .Connector

expression A variable that represents a ShapeRange object.

Remarks

The Connector property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The shape is not a connector.
msoTriStateMixed | Return value indicating a combination of msoTrue and msoFalse for the specified shape range.
msoTrue | The shape is a connector.

Example

This example deletes all connectors on page one of the active publication.

Copy code Copy code
Dim i As Integer

With ActiveDocument.Pages(1).Shapes
 For i = .Count To 1 Step -1
 With .Item(i)
 If .Connector Then .Delete
 End With
 Next
End With


PrintablePlate Object (Publisher)

 Copy code hover
[image]

PrintablePlate Object (Publisher)
Send feedback

This object or member is deprecated and is not intended to be used in your code.


Shape.ParentGroupShape Property (Publisher)

 Copy code hover
[image]

Shape.ParentGroupShape Property (Publisher)
Send feedback

Returns a Shape object that represents the common parent shape of a child shape or a range of child shapes.

Syntax

expression .ParentGroupShape

expression A variable that represents a Shape object.

Return Value

Shape

Example

This example creates two shapes in the active document and groups those shapes. Then using one shape in the group, it accesses the parent group and fills all shapes in the parent group with the same fill pattern. This example assumes that the active document does not currently contain any shapes. If it does, an error may occur.

VBA Copy code Copy code
Sub ParentGroupShape()
 Dim shpGroup As Shape

 With ActiveDocument.Pages(1).Shapes
 .AddShape Type:=msoShapeOval, Left:=72, _
 Top:=72, Width:=100, Height:=100
 .AddShape Type:=msoShapeHeart, Left:=110, _
 Top:=120, Width:=100, Height:=100
 .Range(Array(1, 2)).Group
 End With

 Set shpGroup = ActiveDocument.Pages(1).Shapes(1) _
 .GroupItems(1).ParentGroupShape
 shpGroup.Fill.Patterned Pattern:=msoPattern25Percent

End Sub


ColorsInUse Object (Publisher)

 Copy code hover
[image]

ColorsInUse Object (Publisher)
Send feedback

A collection of ColorFormat objects that represent the colors present in the specified publication.

Remarks

The ColorsInUse collection supports all the publication color models: RGB, process colors, and spot color.

For process color and spot color publications, colors are based on inks. For a given ink, a publication may contain several colors that are different tints or shades of that ink. Use the Plates collection to access the plates that represent the inks defined for a publication.

Example

Use the ColorsInUse property of the Document object to return the ColorsInUse collection.

The following example lists properties of each color in the active publication that is based on the specified ink. This example assumes the publication's color mode has been defined as spot color or process and spot color.

Copy code Copy code
Sub ListColorsBasedOnInk()
Dim cfLoop As ColorFormat

For Each cfLoop In ActiveDocument.ColorsInUse

 With cfLoop
 If .Ink = "2" Then
 Debug.Print "BaseRGB: " & .BaseRGB
 Debug.Print "RGB: " & .RGB
 Debug.Print "TintShade: " & .TintAndShade
 Debug.Print "Type: " & .Type
 End If
 End With

Next cfLoop

End Sub

Use ColorsInUse(index), where index is the color index number, to return a single ColorFormat object. The following example returns properties for the second color in the publication.

Copy code Copy code
Sub ColorProperties()

 With ActiveDocument.ColorsInUse(2)
 Debug.Print "Color RBG: " & .RGB
 Debug.Print "Ink RBG: " & .BaseRGB
 Debug.Print "Tint: " & .TintAndShade

 End With

End Sub


Cell.Height Property (Publisher)

 Copy code hover
[image]

Cell.Height Property (Publisher)
Send feedback

Returns a Long that represent the height (in cells) of a table, range of cells, or page. Read-only.

Syntax

expression .Height

expression A variable that represents a Cell object.

Remarks

The valid range for the Height property depends on the size of the application workspace and the position of the object within the workspace. For centered objects on non-banner page sizes, the Height property may be 0.0 to 50.0 cells. For centered objects on banner page sizes, the Height property may be 0.0 to 241.0 cells.


ConnectorFormat Methods (Publisher)

 Copy code hover
[image]

ConnectorFormat Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
BeginConnect | Attaches the beginning of the specified connector to a specified shape.
BeginDisconnect | Detaches the beginning of the specified connector from the shape to which it is attached.
EndConnect | Attaches the end of the specified connector to a specified shape.
EndDisconnect | Detaches the end of the specified connector from the shape to which it is attached.


BorderArt.Parent Property (Publisher)

 Copy code hover
[image]

BorderArt.Parent Property (Publisher)
See also Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a BorderArt object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub

See also

Concepts

BorderArt Object

Other resources

BorderArt Object Members


ConnectorFormat.EndDisconnect Method (Publisher)

 Copy code hover
[image]

ConnectorFormat.EndDisconnect Method (Publisher)
Send feedback

Detaches the end of the specified connector from the shape to which it is attached.

Syntax

expression .EndDisconnect

expression A variable that represents a ConnectorFormat object.

Remarks

This method doesn't alter the size or position of the connector; the end of the connector remains positioned at a connection site but is no longer connected.

Use the BeginDisconnect method to detach the beginning of the connector from a shape.

Example

This example adds two rectangles to the first page in the active publication, attaches them with a connector, automatically reroutes the connector along the shortest path, and then detaches the connector from the rectangles.

Copy code Copy code
Dim shpRect1 As Shape
Dim shpRect2 As Shape

With ActiveDocument.Pages(1).Shapes

 ' Add two new rectangles.
 Set shpRect1 = .AddShape(Type:=msoShapeRectangle, _
 Left:=100, Top:=50, Width:=200, Height:=100)
 Set shpRect2 = .AddShape(Type:=msoShapeRectangle, _
 Left:=300, Top:=300, Width:=200, Height:=100)

 ' Add a new connector.
 With .AddConnector(Type:=msoConnectorCurve, _
 BeginX:=0, BeginY:=0, EndX:=0, EndY:=0) _
 .ConnectorFormat

 ' Connect the new connector to the two rectangles.
 .BeginConnect ConnectedShape:=shpRect1, ConnectionSite:=1
 .EndConnect ConnectedShape:=shpRect2, ConnectionSite:=1

 ' Reroute the connector to create the shortest path.
 .Parent.RerouteConnections

 ' Disconnect the new connector from the rectangles but
 ' leave in place.
 .BeginDisconnect
 .EndDisconnect
 End With

End With


Shape.Shadow Property (Publisher)

 Copy code hover
[image]

Shape.Shadow Property (Publisher)
Send feedback

Returns a ShadowFormat object that represents the shadow formatting for the specified shape.

Syntax

expression .Shadow

expression A variable that represents a Shape object.

Example

This example adds an arrow with shadow formatting and fill color to the first page in the active document.

VBA Copy code Copy code
Sub SetShapeShadow()
 With ActiveDocument.Pages(1).Shapes.AddShape( _
 Type:=msoShapeRightArrow, Left:=72, _
 Top:=72, Width:=64, Height:=43)
 .Shadow.Type = msoShadow5
 .Fill.ForeColor.RGB = RGB(Red:=255, Green:=0, Blue:=255)
 End With
End Sub


Font.StylisticAlternates Property (Publisher)

 Copy code hover
[image]

Font.StylisticAlternates Property (Publisher)
Send feedback

Returns or sets a Variant that represents the state of the StylisticAlternates property on the characters in a text range. The StylisticAlternates property allows you to select an alternate look for the look of the characters you have selected, if the font designer has created these alternates. Read/write.

Version Information

Version Added: Publisher 2010

Syntax

expression .StylisticAlternates

expression A variable that represents a Font object.

Remarks

Note Note

The StylisticAlternates property has an effect only for OpenType fonts that contain stylistic alternatives.


Shape.Copy Method (Publisher)

 Copy code hover
[image]

Shape.Copy Method (Publisher)
Send feedback

Copies the specified object to the Clipboard.

Syntax

expression .Copy

expression A variable that represents a Shape object.

Remarks

Use the Paste method to paste the contents of the Clipboard.

The Copy method can be used on Shape objects, but the Paste method cannot.

Example

This example copies shapes one and two on page one of the active publication to the Clipboard and then pastes the copies onto page two.

VBA Copy code Copy code
With ActiveDocument
 .Pages(1).Shapes.Range(Array(1, 2)).Copy
 .Pages(2).Shapes.Paste
End With

This example copies shape one on page one of the active publication to the Clipboard.

Copy code Copy code
ActiveDocument.Pages(1).Shapes(1).Copy

This example copies the text in shape one on page one of the active publication to the Clipboard.

Copy code Copy code
ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange.Copy


PictureFormat.IncrementContrast Method (Publisher)

 Copy code hover
[image]

PictureFormat.IncrementContrast Method (Publisher)
Send feedback

Changes the contrast of the picture by the specified amount.

Syntax

expression .IncrementContrast(Increment)

expression A variable that represents a PictureFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how much to change the value of the Contrast property for the picture. A positive value increases the contrast; a negative value decreases the contrast. Valid values are between - 1 and 1.

Remarks

You cannot adjust the contrast of a picture past the upper or lower limit for the Contrast property. For example, if the Contrast property is initially set to 0.9 and you specify 0.3 for the Increment argument, the resulting contrast level will be 1.0, which is the upper limit for the Contrast property, instead of 1.2.

Use the Contrast property to set the absolute contrast for the picture.

Example

This example increases the contrast for all pictures on the first page of the active publication that aren't already set to maximum contrast.

Copy code Copy code
Dim shpLoop As Shape

For Each shpLoop In ActiveDocument.Pages(1).Shapes
 If shpLoop.Type = msoPicture Then
 shpLoop.PictureFormat.IncrementContrast Increment:=0.1
 End If
Next shpLoop


WebCommandButton Properties (Publisher)

 Copy code hover
[image]

WebCommandButton Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
ActionURL | Returns or sets a String that represents the URL of the server-side script to execute in response to a Submit button click. Read/write.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
ButtonText | Returns or sets a String that represents the text that appears on the face of a Web command button. Read/write.
ButtonType | Returns or sets a PbCommandButtonType constant that indicates whether a Web command button will clear or submit form data. Read/write.
DataFileFormat | Sets or returns a PbSubmitDataFormatType constant that represents the format to use when saving Web form data to a file. Read/write.
DataFileName | Returns or sets a String that represents the name of the file in which to save data from a Web form. Read/write.
DataRetrievalMethod | Sets or returns a PbSubmitDataRetrievalMethodType that represents the way data from a Web form is processed. Read/write.
EmailAddress | Sets or returns a String representing the e-mail address to use when processing Web form data. Read/write.
EmailSubject | Sets or returns a String that represents the subject for e-mail messages generated to process Web form data. Read/write.
HiddenFields | Returns a WebHiddenFields object that represents hidden Web fields attached to a Submit command button.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
PostFormData | Returns or sets an MsoTriState constant indicating whether the specified Web command button control uses the Microsoft Visual Basic Get or Post method when submitting form data to a Web server. Read/write.


GroupShapes.Item Method (Publisher)

 Copy code hover
[image]

GroupShapes.Item Method (Publisher)
Send feedback

Returns an individual object in a specified collection.

Syntax

expression .Item(Index)

expression A variable that represents a GroupShapes object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The number or name of the field or list box item to return.

Return Value

Shape

Example

This example returns the first shape inside a grouped shape.

VBA Copy code Copy code
Dim shpTemp As Shape

Set shpTemp = ActiveDocument.Pages(Index:=1) _
 .Shapes(1).GroupItems.Item(Index:=1)


GroupShapes Properties (Publisher)

 Copy code hover
[image]

GroupShapes Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Document.Saved Property (Publisher)

 Copy code hover
[image]

Document.Saved Property (Publisher)
Send feedback

Returns True if no changes have been made to a publication since it was last saved. Read-only Boolean.

Syntax

expression .Saved

expression A variable that represents a Document object.

Return Value

Boolean

Remarks

If the Saved property of a modified publication returns True, the user won't be prompted to save changes when closing the publication, and all changes made to it since it was last saved will be lost.

Example

This example saves the active publication if it has been changed since the last time it was saved.

VBA Copy code Copy code
Sub Saver()

 With Application.ActiveDocument
 If Not .Saved And .Path <> "" Then .Save
 End With

End Sub


Row Properties (Publisher)

 Copy code hover
[image]

Row Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Cells | Returns a CellRange object that represents the cell or cells in row of a table.
Height | Returns or sets a Variant that represents the height (in points) of a specified table row or shape. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


PbPrintMode Enumeration (Publisher)

 Copy code hover
[image]

PbPrintMode Enumeration (Publisher)
Send feedback

Represents whether the specified publication is printed as a composite or separations.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbPrintModeCompositeCMYK | 3 | Print a composite whose colors are defined by the CMYK color model.
pbPrintModeCompositeGrayscale | 4 | Print a composite whose colors are defined as shades of gray.
pbPrintModeCompositeRGB | 1 | Print a composite whose colors are defined by the RGB color model.
pbPrintModeSeparations | 2 | Print a separate plate for each ink used in the publication.


BorderArtFormat.StretchPictures Property (Publisher)

 Copy code hover
[image]

BorderArtFormat.StretchPictures Property (Publisher)
See also Send feedback

True to stretch the picture art making up the specified BorderArt to fit the shape to which it is applied. Read/write Boolean. .

Syntax

expression .StretchPictures

expression A variable that represents a BorderArtFormat object.

Return Value

Boolean

Remarks

Returns "Permission Denied" if BorderArt has not been applied to the specified object.

Corresponds to the Don't stretch pictures and Stretch pictures to fit controls on the BorderArt dialog box.

Example

The following example tests for the existence of BorderArt on each shape for each page of the active document. If BorderArt exists, it is set so that it can be stretched.

VBA Copy code Copy code
Sub StretchBorderArt()
 Dim anyPage As Page
 Dim anyShape As Shape

 For Each anyPage in ActiveDocument.Pages
 For Each anyShape in anyPage.Shapes
 With anyShape.BorderArt
 If .Exists = True Then
 .StretchPictures = True
 End If
 End With
 Next anyShape
 Next anyPage
End Sub

See also

Concepts

BorderArtFormat Object

Other resources

BorderArtFormat Object Members


BorderArts Methods (Publisher)

 Copy code hover
[image]

BorderArts Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Item | Returns an individual object in a specified collection.


WebNavigationBarSet.IsHorizontal Property (Publisher)

 Copy code hover
[image]

WebNavigationBarSet.IsHorizontal Property (Publisher)
Send feedback

True if the specified WebNavigationBarSet has a horizontal orientation. Read-only Boolean.

Syntax

expression .IsHorizontal

expression A variable that represents an WebNavigationBarSet object.

Return Value

Boolean

Remarks

This property is used to determine the orientation of the navigation bar set prior to setting certain properties that assume a horizontal orientation such as the HorizontalAlignment property.

Example

This example adds the first navigation bar in the WebNavigationBarSets collection of the active document to each page, and then sets the button style to small. A test is performed to determine whether the navigation bar set is horizontal or not. If it is not, the ChangeOrientation method is called and the orientation is set to horizontal. After the navigation bar is oriented horizontally, the horizontal button count is set to 3 and the horizontal alignment of the buttons is set to left.

Copy code Copy code
Dim objWebNav As WebNavigationBarSet
Set objWebNav = ActiveDocument.WebNavigationBarSets(1)
With objWebNav
 .AddToEveryPage Left:=10, Top:=10
 .ButtonStyle = pbnbButtonStyleSmall
 If .IsHorizontal = False Then
 .ChangeOrientation pbNavBarOrientHorizontal
 End If
 .HorizontalButtonCount = 3
 .HorizontalAlignment = pbnbAlignLeft
End With


Application.DocumentBeforeClose Event (Publisher)

 Copy code hover
[image]

Application.DocumentBeforeClose Event (Publisher)
See also Send feedback

Occurs immediately before any open document closes.

Syntax

expression .DocumentBeforeClose(Doc, Cancel)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The document that is being closed.
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the document does not close when the procedure is finished.

Remarks

To access the Application object events, declare an Application object variable in the General Declarations section of a code module. Then set the variable equal to the Application object for which you want to access events. For information about using events with the Microsoft Publisher Application object, see Using Events with the Application Object .

Example

This example prompts the user for a yes or no response before closing a document. To see this example work, this code must be placed in a class module and an instance of the class must be correctly initialized, using an example similar to the SetPubApp routine below.

Copy code Copy code
Private WithEvents PubApp As Application

Sub SetPubApp()
 Set PubApp = Publisher.Application
End Sub

Private Sub PubApp_DocumentBeforeClose(ByVal Doc As Document, Cancel As Boolean)

 Dim intResponse As Integer

 intResponse = MsgBox("Do you really want to close " _
 & "the document?", vbYesNo)

 If intResponse = vbNo Then Cancel = True

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


MailMergeDataField.MapToRecipientField Method (Publisher)

 Copy code hover
[image]

MailMergeDataField.MapToRecipientField Method (Publisher)
Send feedback

Maps a field (column) in a particular data source represented by the parent MailMergeDataField object to a recipient field (column) in the master data source (combined mail-merge recipient list).

Version Information

Version Added: Publisher 2007

Syntax

expression .MapToRecipientField(bstrValue)

expression A variable that represents a MailMergeDataField object.

Parameters

Name | Required/Optional | Data Type | Description
bstrValue | Optional | String | The name of the recipient field that the data source column is to be mapped to.

Remarks

This method works only if the parent MailMergeDataField object has not already been mapped to a recipient field. You can use the IsMapped property of the MailMergeDataField object to determine if the object has already been mapped.

If you do not pass a value for the optional bstrValue parameter, Microsoft Publisher assumes that the field to be mapped has the same name as the recipient field in the master data source to which it is mapped.

If you pass the name of a field that does not exist, Publisher returns an error.

Note Note

To add a field, use the AddToRecipientFields method.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the MapToRecipientField method to map a data field (column) in a particular data source to a field in the master data source (combined recipient list) for the publication.

Before running this macro, replace datasourceindex with the index number of a valid data source in the data source collection of the active document, replace fieldname with the name of the field in the data source that you want to map to a recipient field, and replace recipientfieldname with the name of the recipient field.

See the Item method topic for an example of how you can use the Name property of the DataSource object to determine the index number of the data source you want.

VBA Copy code Copy code
Public Sub Map()

 Dim pubMailMergeDataSources As Publisher.MailMergeDataSources
 Dim pubMailMergeDataField As Publisher.MailMergeDataField

 Set pubMailMergeDataSources = ThisDocument.MailMerge.DataSource.DataSources
 Set pubMailMergeDataField = pubMailMergeDataSources.Item(datasourceindex).DataFields.Item("fieldname")

 If pubMailMergeDataField.IsMapped Then

 Debug.Print "This field is already mapped"

 Else

 pubMailMergeDataField.MapToRecipientField ("recipientfieldname")
 Debug.Print "Field mapped successfully."

 End If

End Sub


Tags.Application Property (Publisher)

 Copy code hover
[image]

Tags.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a Tags object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


WebPageOptions.PublishFileName Property (Publisher)

 Copy code hover
[image]

WebPageOptions.PublishFileName Property (Publisher)
Send feedback

Returns or sets a String that represents the file name of a Web page (within a Web publication) that is being saved as filtered HTML.

Syntax

expression .PublishFileName

expression A variable that represents a WebPageOptions object.

Return Value

String

Remarks

Specifying a file name for a Web page is optional. When a publication is saved as filtered HTML, Microsoft Publisher automatically generates a file name for any Web page that does not have a file name specified. Use the SaveAs method of the Document object to save a publication as filtered HTML.

User-defined file names are used only when a publication is saved as filtered HTML.

File names must be specified without a file name extension.

Including invalid characters (such as characters that are not universally allowed in file names that are part of URLs) in the file name generates a run-time error. Invalid characters include:

  • characters with a code point value of below (decimal) 48

  • any double-byte characters

  • the following symbols: \, ?, >, <, |, : , and .

This property corresponds to the File name text box in the Publish to the Web section of the Web Page Options dialog box.

Example

The following example sets the file name and description of the second page in the active publication. The example assumes the active publication is a Web publication containing at least two pages.

VBA Copy code Copy code
With ActiveDocument.Pages(2).WebPageOptions
 .PublishFileName = "CompanyProfile"
 .Description = "Tailspin Toys Company Profile"
End With


ThreeDFormat.BevelTopInset Property (Publisher)

 Copy code hover
[image]

ThreeDFormat.BevelTopInset Property (Publisher)
See also Send feedback

Returns or sets a Single that represents the depth of the top bevel. Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .BevelTopInset

expression A variable that represents a ThreeDFormat object.

Return value

Single

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


PageSizes Properties (Publisher)

 Copy code hover
[image]

PageSizes Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the creator of the parent PageSizes collection. Read-only.
Count | Returns the number of PageSize objects in the PageSizes collection of the active document. Read-only.
Item | Returns the PageSize object with the specified name or at the specified index position in the PageSizes collection. Read-only.
Parent | Returns the parent of the PageSizes collection. Read-only.


WebCommandButton.PostFormData Property (Publisher)

 Copy code hover
[image]

WebCommandButton.PostFormData Property (Publisher)
Send feedback

Returns or sets an MsoTriState constant indicating whether the specified Web command button control uses the Microsoft Visual Basic Get or Post method when submitting form data to a Web server. Read/write.

Syntax

expression .PostFormData

expression A variable that represents a WebCommandButton object.

Return Value

MsoTriState

Remarks

The property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The control uses the Visual Basic Get method to submit form data.
msoTrue | The control uses the Visual Basic Post method to submit form data. The default value.

This property is ignored for Reset command buttons.

Example

This example creates a Web form Submit command button and sets the script path and file name to run when a user clicks the button. The example also specifies that the Web form should use the Visual Basic Get method to submit form data.

VBA Copy code Copy code
Dim shpNew As Shape

Set shpNew = ActiveDocument.Pages(1).Shapes.AddWebControl _
 (Type:=pbWebControlCommandButton, Left:=150, _
 Top:=150, Width:=75, Height:=36)

With shpNew.WebCommandButton
 .ButtonText = "Submit"
 .ButtonType = pbCommandButtonSubmit
 .ActionURL = "http://www.tailspintoys.com/" _
 & "scripts/ispscript.cgi"
 .PostFormData = msoFalse
End With


Document Properties (Publisher)

 Copy code hover
[image]

Document Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
ActiveView | Returns a View object representing the view attributes for the specified document. Read-only.
ActiveWindow | Returns a Window object that represents the window with the focus. Because Microsoft Publisher only has one window, there is only one Window object to return.
AdvancedPrintOptions | Returns an AdvancedPrintOptions object that represents the advanced print settings for a publication. Read-only.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
AvailableBuildingBlocks | Returns the available members of the BuildingBlocks collection of the current document. Read-only.
BorderArts | Returns a BorderArts collection that represents the BorderArt types available for use in the specified publication. Read-only.
ColorScheme | Returns or sets the ColorScheme object that represents the scheme colors for the specified publication. Read/write.
DefaultTabStop | Returns or sets a Variant corresponding to the default tab stop for all text in the active publication. Valid range is 1 to 1584 points (0.014" to 22"). Once set, numeric values are considered to be in points. String values may be in any unit supported by Microsoft Publisher. Point values are always returned. If values are outside the valid range, an error is returned. Read/write.
DocumentDirection | Returns or sets a PbDirectionType constant that indicates whether text in the document is read from left to right or from right to left. Read/write.
EnvelopeVisible | Returns or sets a Boolean indicating whether the e-mail message header is visible in the publication window. Read/write.
Find |
FullName | Returns a String representing the full file name of the saved active publication, including its path and file name. Read-only.
IsDataSourceConnected | True if the specified publication is connected to a data source. Read-only.
IsWizard | Returns True if the specified publication is a publication generated by a Microsoft Publisher wizard. Read-only Boolean.
LayoutGuides | Returns a LayoutGuides object consisting of the margin and grid layout guides for all pages including master pages in the publication.
MailEnvelope | Returns an MsoEnvelope object that represents an e-mail header for a publication.
MailMerge | Returns a MailMerge object that represents the mail merge functionality for the specified publication.
MasterPages | Returns the MasterPages collection for the specified publication.
Name | Returns a String value indicating the name of the specified object. Read-only.
Pages | Returns a Pages collection representing all the pages in the specified publication.
PageSetup | Returns a PageSetup object representing a publication's page size, page layout and paper settings. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Path | Returns a String indicating the full path to the file of the saved active publication, not including the last separator or file name.
PrintPageBackgrounds | Returns or sets True to include page backgrounds when printing pages from the specified publication. Default is True. Read/write Boolean.
PrintStyle | Read-only
PublicationType | Returns a PbPublicationType constant that represents the type of the specified publication. Read-only.
ReadOnly | Returns True if the publication is read-only; returns False if it is read/write. Read-only Boolean.
RedoActionsAvailable | Returns the number of actions available on the redo stack. Read-only Long.
RemovePersonalInformation | Returns or sets a Boolean that represents whether to save personal information when the file is saved. Read/write.
Saved | Returns True if no changes have been made to a publication since it was last saved. Read-only Boolean.
SaveFormat | Indicates the file format of the specified document. Read-only.
ScratchArea | Returns a ScratchArea object for an a given document.
Sections | Returns a Sections object representing a collection of Section objects in the specified document. Read-only Sections.
Selection | Returns a Selection object that represents a selected range or the cursor.
Stories | Returns a Stories collection containing all stories in the publication.
SurplusShapes | Returns a ShapeRange object that represents the collection of surplus shapes that Microsoft Publisher places under Extra Content in the Format Publication task pane after the document template (wizard) is changed by using the Document.ChangeDocument method or by using the Change Template command in the user interface. Read-only.
Tags | Returns a Tags collection representing tags or custom properties applied to a shape, shape range, page, or publication.
TextStyles | Returns a TextStyles collection that contains a publication's text styles.
UndoActionsAvailable | Returns the number of actions available on the undo stack. Read-only Long.
ViewBoundaries | Returns True if object boundaries are visible in the specified publication. Read/write Boolean.
ViewGuides | Returns True if guides are visible in the specified publication. Read/write Boolean.
ViewHorizontalBaseLineGuides | Sets or returns a Boolean that represents whether or not the horizontal baseline guides are visible in the specified Document object. True if they are visible. False if they are not visible. Read/write.
ViewTwoPageSpread | Returns True if the specified publication should be viewed as a two-page spread. Read/write Boolean.
ViewVerticalBaseLineGuides | Sets or returns a Boolean that represents whether or not the vertical baseline guides are visible in the specified Document object. True if they are visible. False if they are not visible. Read/write.
WebNavigationBarSets | Returns a WebNavigationBarSets object representing a collection of all WebNavigationBarSet objects in the specified document. Read-only.
Wizard | Returns a Wizard object representing the publication design associated with the specified publication or the wizard associated with the specified Design Gallery object.


WebCommandButton Members (Publisher)

 Copy code hover
[image]

WebCommandButton Members (Publisher)
Send feedback

Represents a Web command button control. The WebCommandButton object is a member of the Shape object.

Properties

Name | Description
ActionURL | Returns or sets a String that represents the URL of the server-side script to execute in response to a Submit button click. Read/write.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
ButtonText | Returns or sets a String that represents the text that appears on the face of a Web command button. Read/write.
ButtonType | Returns or sets a PbCommandButtonType constant that indicates whether a Web command button will clear or submit form data. Read/write.
DataFileFormat | Sets or returns a PbSubmitDataFormatType constant that represents the format to use when saving Web form data to a file. Read/write.
DataFileName | Returns or sets a String that represents the name of the file in which to save data from a Web form. Read/write.
DataRetrievalMethod | Sets or returns a PbSubmitDataRetrievalMethodType that represents the way data from a Web form is processed. Read/write.
EmailAddress | Sets or returns a String representing the e-mail address to use when processing Web form data. Read/write.
EmailSubject | Sets or returns a String that represents the subject for e-mail messages generated to process Web form data. Read/write.
HiddenFields | Returns a WebHiddenFields object that represents hidden Web fields attached to a Submit command button.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
PostFormData | Returns or sets an MsoTriState constant indicating whether the specified Web command button control uses the Microsoft Visual Basic Get or Post method when submitting form data to a Web server. Read/write.


Fields Methods (Publisher)

 Copy code hover
[image]

Fields Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
AddHorizontalInVertical | Inserts horizontal text into a stream of vertical text and returns the new horizontal text as a Field object.
AddPhoneticGuide | Returns a Field object that represents phonetic text added to the specified range.
Item | Returns an individual object in a specified collection.
Unlink | Replaces the specified field or Fields collection with with their most recent results.


Plate.Parent Property (Publisher)

 Copy code hover
[image]

Plate.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a Plate object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


TabStops Properties (Publisher)

 Copy code hover
[image]

TabStops Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Pages Object (Publisher)

 Copy code hover
[image]

Pages Object (Publisher)
Send feedback

Represents all the pages in a publication. The Pages collection contains all the Page objects in a publication.

Example

Use the Add method to add a new page to a publication. The following example adds a new page and a shape to the active publication.

Copy code Copy code
Sub AddPageAndShape()
 With ActiveDocument.Pages.Add(Count:=1, After:=1)
 With .Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=50, Height:=50)
 .Fill.ForeColor.RGB = RGB(Red:=128, Green:=50, Blue:=255)
 .Line.ForeColor.RGB = RGB(Red:=75, Green:=50, Blue:=255)
 End With
 End With

End Sub


ShapeRange.Shadow Property (Publisher)

 Copy code hover
[image]

ShapeRange.Shadow Property (Publisher)
Send feedback

Returns a ShadowFormat object that represents the shadow formatting for the specified shape.

Syntax

expression .Shadow

expression A variable that represents a ShapeRange object.

Example

This example adds an arrow with shadow formatting and fill color to the first page in the active document.

VBA Copy code Copy code
Sub SetShapeShadow()
 With ActiveDocument.Pages(1).Shapes.AddShape( _
 Type:=msoShapeRightArrow, Left:=72, _
 Top:=72, Width:=64, Height:=43)
 .Shadow.Type = msoShadow5
 .Fill.ForeColor.RGB = RGB(Red:=255, Green:=0, Blue:=255)
 End With
End Sub


PbDriverType Enumeration (Publisher)

 Copy code hover
[image]

PbDriverType Enumeration (Publisher)
Send feedback

Driver-type constants returned by the Printer.DriverType property.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbDriverTypeNonPostScript | 1 | Non PostScript
pbDriverTypePostScript1 | 2 | PostScript 1
pbDriverTypePostScript2 | 3 | PostScript 2
pbDriverTypePostScript3 | 4 | PostScript 3


ShapeRange.ID Property (Publisher)

 Copy code hover
[image]

ShapeRange.ID Property (Publisher)
Send feedback

Returns a Long that represents the type of a shape, range of shapes, or property, type, or value of a wizard. Read-only.

Syntax

expression .ID

expression A variable that represents a ShapeRange object.

Example

This example displays the type for each shape on the first page of the active publication.

Copy code Copy code
Sub ShapeID()
 Dim shp As Shape
 For Each shp In ActiveDocument.Pages(1).Shapes
 MsgBox shp.ID
 Next shp
End Sub


TextEffectFormat.PresetTextEffect Property (Publisher)

 Copy code hover
[image]

TextEffectFormat.PresetTextEffect Property (Publisher)
Send feedback

Returns or sets an MsoPresetTextEffect constant that represents the style of the specified WordArt. The values for this property correspond to the formats in the WordArt Gallery dialog box, numbered from left to right, top to bottom. Read/write.

Syntax

expression .PresetTextEffect

expression A variable that represents a TextEffectFormat object.

Return Value

MsoPresetTextEffect

Remarks

The PresetTextEffect property value can be one of the MsoPresetTextEffect constants declared in the Microsoft Office type library.

Example

This example sets the text effect style for the first shape on the first page of the active publication. This example assumes that there is at least one shape on the first page of the active publication.

VBA Copy code Copy code
Sub ChangeTextEffect()
 With ActiveDocument.Pages(1).Shapes(1)
 If .Type = msoTextEffect Then
 .TextEffect.PresetTextEffect = msoTextEffect1
 End If
 End With
End Sub


Shape.MoveIntoTextFlow Method (Publisher)

 Copy code hover
[image]

Shape.MoveIntoTextFlow Method (Publisher)
Send feedback

Moves a given shape into the text flow defined by TextRange Object. The shape will always be inserted inline at the beginning of the text flow.

Syntax

expression .MoveIntoTextFlow(Range)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | TextRange | The range of text before which the given shape is inserted.

Return Value

Nothing

Remarks

The MoveIntoTextFlow method will fail if the shape to be moved is already inline or if it is not a valid inline shape type. Invalid inline shape types include:

  • Inline shapes

  • Grouped shapes

  • HTML fragments

  • Smart objects

  • Chained text boxes

Example

The following example checks if the second shape on the second page of the publication is inline, and if it is not, inserts it inline at the beginning of the text flow of the given text range.

Copy code Copy code
Dim theShape As Shape
Dim theRange As TextRange

Set theRange = ActiveDocument.Pages(2).Shapes(1).TextFrame.TextRange
Set theShape = ActiveDocument.Pages(2).Shapes(2)

If Not theShape.IsInline = msoTrue Then
 theShape.MoveIntoTextFlow Range:=theRange
End If


WizardProperty.CurrentValueId Property (Publisher)

 Copy code hover
[image]

WizardProperty.CurrentValueId Property (Publisher)
Send feedback

Returns or sets a Long indicating the value of a setting in the specified publication design or Design Gallery object's wizard. Read/write.

Syntax

expression .CurrentValueId

expression A variable that represents a WizardProperty object.

Return Value

Long

Remarks

Accessing this property for a publication design setting whose Enabled property is False causes an error.

Example

The following example changes the settings of the current publication design (Newsletter Wizard) so that the publication has a region dedicated to the customer's address.

Copy code Copy code
Dim wizTemp As Wizard
Dim wizproAll As WizardProperties

Set wizTemp = ActiveDocument.Wizard

With wizTemp.Properties
 .FindPropertyById(ID:=901).CurrentValueId = 1
End With


Document.Tags Property (Publisher)

 Copy code hover
[image]

Document.Tags Property (Publisher)
Send feedback

Returns a Tags collection representing tags or custom properties applied to a shape, shape range, page, or publication.

Syntax

expression .Tags

expression A variable that represents a Document object.

Example

This example adds a tag to each oval shape on the first page of the active publication.

Copy code Copy code
Dim shp As Shape
Dim tagsAll As Tags
Dim tagLoop As Tag
Dim blnTag As Boolean

With ActiveDocument.Pages(1)
 For Each shp In .Shapes
 If shp.AutoShapeType = msoShapeOval Then
 Set tagsAll = shp.Tags
 blnTag = False

 For Each tagLoop In tagsAll
 If tagLoop.Name = "Shape" Then
 blnTag = True
 Exit For
 End If
 Next tagLoop

 If blnTag = False Then
 tagsAll.Add Name:="Shape", Value:="Oval"
 End If
 End If
 Next shp
End With


WizardValue.ID Property (Publisher)

 Copy code hover
[image]

WizardValue.ID Property (Publisher)
Send feedback

Returns a Long that represents the type of a shape, range of shapes, or property, type, or value of a wizard. Read-only.

Syntax

expression .ID

expression A variable that represents a WizardValue object.

Example

This example displays the type for each shape on the first page of the active publication.

Copy code Copy code
Sub ShapeID()
 Dim shp As Shape
 For Each shp In ActiveDocument.Pages(1).Shapes
 MsgBox shp.ID
 Next shp
End Sub


ReflectionFormat Properties (Publisher)

 Copy code hover
[image]

ReflectionFormat Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Blur | Returns or sets a Single that specifies the degree of blur effect applied to the specified object. Read/write.
Offset | Returns or sets the amount of separation, in points, of the reflected image from the shape. Read/write.
Size | Returns or sets the size of the reflection as a percentage of the reflected shape from 0 to 100. Read/write.
Transparency | Returns or sets the degree of transparency for the reflection effect as a value between 0.0 (opaque) and 1.0 (clear). Read/write Single.
Type | Returns or sets an MsoReflectionType constant that represents the type and distance from the shape of the reflection. Read/write.
Visible | True if the specified object or the formatting applied to it is visible. Read/write MsoTriState.


CaptionStyles.Item Method (Publisher)

 Copy code hover
[image]

CaptionStyles.Item Method (Publisher)
Send feedback

Returns the specified CaptionStyle object from a CaptionStyles collection. Read-only.

Syntax

expression .Item(Index)

expression A variable that represents a CaptionStyles object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The index number in the collection of the caption style to return.

Return Value

CaptionStyle


PageBackground.Parent Property (Publisher)

 Copy code hover
[image]

PageBackground.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a PageBackground object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


EmailMergeEnvelope.Cc Property (Publisher)

 Copy code hover
[image]

EmailMergeEnvelope.Cc Property (Publisher)
Send feedback

Gets or sets the MailMergeDataField object that represents the data-source field (column) that lists the e-mail addresses of recipients you want to receive a carbon copy (CC) of the merged e-mail message. Read/write.

Version Information

Version Added: Publisher 2007

Syntax

expression .Cc

expression A variable that represents an EmailMergeEnvelope object.

Return Value

MailMergeDataField

Remarks

You must make certain that you assign the correct data-source field (the one that represents CC e-mail addresses) to the Cc property. You can use the following line of code, which gets the value of the Name property of the MailMergeDataField object to which Cc is assigned, to ensure that you make the correct assignment:

VBA Copy code Copy code
Debug.Print ThisDocument.MailMerge.EmailMergeEnvelope.Cc.Name

For an example of how to set the Cc property value, see the EmailMergeEnvelope object topic.


Column Properties (Publisher)

 Copy code hover
[image]

Column Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Cells | Returns a CellRange object that represents the cell or cells in a column of a table.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Width | Returns or sets a Variant that represents the width (in points) of a specified table column or shape. Read/write.


Page Members (Publisher)

 Copy code hover
[image]

Page Members (Publisher)
Send feedback

Represents a page in a publication. The Pages collection contains all the Page objects in a publication.

Methods

Name | Description
Delete | Deletes the specified object.
Duplicate | Creates a duplicate of the specified Page object and then returns the new Page object.
ExportEmailHTML | Exports the active page of the publication as an HTML file.
Move | Moves the specified page to the specified index in the Pages collection.
SaveAsPicture | Saves a page as a picture file.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Background | Sets or returns a PageBackground object representing the background of the specified page.
Footer | Returns a HeaderFooter object representing the footer of the specified Page object. Read-only.
Header | Returns a HeaderFooter object representing the header of the specified Page object. Read-only.
Height | Returns a Long that represent the height (in points) of a cell, range of cells, or page. Read-only.
IgnoreMaster | True for Microsoft Publisher to ignore the master page formatting for the specified page. Read/write Boolean.
IsLeading | True if the specified Page object is a leading page of a two-page spread. Read-only Boolean.
IsTrailing | True if the specified Page object is a trailing page of a two-page spread. Read-only Boolean.
IsTwoPageMaster | True if the specified Page object is a two-page master. Read/write Boolean.
IsWizardPage | Returns True if the specified page is a Microsoft Publisher wizard page. Read-only Boolean.
LayoutGuides | Returns a LayoutGuides object consisting of the margin and grid layout guides for all pages including master pages in the publication.
Master | Sets or returns a Page object that represents the master page properties for the specified page.
Name | Returns or sets a String value indicating the name of the specified object. Read/write.
PageID | Returns a Long indicating the unique identifier for a page in a publication. Read-only.
PageIndex | Gets the index of the page in the Pages collection of the active document. Read-only.
PageNumber | Returns a String that represents the current page number. Read-only.
PageType | Returns a PbPageType constant that represents the page type. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
ReaderSpread | Returns a ReaderSpread object that represents the reader spread of the specified page.
RulerGuides | Returns a RulerGuides collection that represents gridlines used to align objects on a page.
Shapes | Returns a Shapes collection that represents all the Shape objects in the specified publication. This collection can contain drawings, shapes, pictures, OLE objects, ActiveX controls, text objects, and callouts.
Tags | Returns a Tags collection representing tags or custom properties applied to a shape, shape range, page, or publication.
WebPageOptions | Returns a WebPageOptions object, which represents the properties of a single Web page within a Web publication. Read-only.
Width | Returns a Long that represent the width (in points) of a cell, range of cells, or page. Read-only.
Wizard | Returns a Wizard object representing the publication design associated with the specified publication or the wizard associated with the specified Design Gallery object.
XOffsetWithinReaderSpread | Returns a Single that represents the distance (in points) from the left edge of the reader spread to the left edge of the page. Read-only.
YOffsetWithinReaderSpread | Returns a Single that represents the distance (in points) from the top edge of the reader spread to the top edge of the page. Read-only.


Enumerations (Publisher)

 Copy code hover
[image]

Enumerations (Publisher)
Send feedback

This section contains documentation for the enumerations in the Publisher object model.


BuildingBlock.ShowInGallery Property (Publisher)

 Copy code hover
[image]

BuildingBlock.ShowInGallery Property (Publisher)
Send feedback

A Boolean value that specifies whether the building block should be displayed in the ribbon gallery it belongs to. Read/write.

Syntax

expression .ShowInGallery

expression A variable that represents a BuildingBlock object.


Options.PathForPublications Property (Publisher)

 Copy code hover
[image]

Options.PathForPublications Property (Publisher)
Send feedback

Returns a String that represents the default folder for publications. Read.

Syntax

expression .PathForPublications

expression A variable that represents a Options object.

Return Value

String

Example

This example returns the current default path for publications (corresponds to the default path setting on the General tab in the Options dialog box, Tools menu).

VBA Copy code Copy code
Sub PubPath()
 Dim strPubPath
 strPubPath = Options.PathForPublications
 MsgBox strPubPath
End Sub


InstalledPrinters.Application Property (Publisher)

 Copy code hover
[image]

InstalledPrinters.Application Property (Publisher)
Send feedback

Returns an Application object that represents the creator of the parent InstalledPrinters object. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .Application

expression A variable that represents an InstalledPrinters object.

Return Value

Application


WebNavigationBarSet.AddToEveryPage Method (Publisher)

 Copy code hover
[image]

WebNavigationBarSet.AddToEveryPage Method (Publisher)
Send feedback

Adds a ShapeRange of type pbWebNavigationBar to each page of the current document.

Syntax

expression .AddToEveryPage(Left, Top, Width)

expression A variable that represents a WebNavigationBarSet object.

Parameters

Name | Required/Optional | Data Type | Description
Left | Required | Variant | The position of the left edge of the shape representing the Web navigation bar set.
Top | Required | Variant | The position of the top edge of the shape representing the Web navigation bar set.
Width | Optional | Variant | The width of the shape representing the Web navigation bar set.

Return Value

ShapeRange

Remarks

The specified Web navigation bar set must exist before calling this method.

Example

The following example adds a Web navigation bar set named "WebNavBarSet1" to the top of every page in the active document.

Copy code Copy code
ActiveDocument.WebNavigationBarSets("WebNavBarSet1") _
 .AddToEveryPage Left:=10, Top:=20

The following example adds a new Web navigation bar set to the active document and adds it to every page of the publication.

Copy code Copy code
Dim objWebNavBarSet As WebNavigationBarSet

Set objWebNavBarSet = ActiveDocument.WebNavigationBarSets.AddSet( _
 Name:="WebNavBarSet1", _
 Design:=pbnbDesignTopLine, _
 AutoUpdate:=True)

objWebNavBarSet.AddToEveryPage Left:=50, Top:=10, Width:=500


ConnectorFormat.EndConnect Method (Publisher)

 Copy code hover
[image]

ConnectorFormat.EndConnect Method (Publisher)
Send feedback

Attaches the end of the specified connector to a specified shape.

Syntax

expression .EndConnect(ConnectedShape, ConnectionSite)

expression A variable that represents a ConnectorFormat object.

Parameters

Name | Required/Optional | Data Type | Description
ConnectedShape | Required | Shape | The shape to which Microsoft Publisher attaches the end of the connector. The specified Shape object must be in the same Shapes collection as the connector.
ConnectionSite | Required | Long | A connection site on the shape specified by ConnectedShape. Must be an integer between 1 and the integer returned by the ConnectionSiteCount property of the specified shape. Connection sites are numbered starting from the top of the specified shape and moving counterclockwise around the shape. If you want the connector to automatically find the shortest path between the two shapes it connects, specify any valid integer for this argument and then use the RerouteConnections method after the connector is attached to shapes at both ends.

Remarks

If there's already a connection between the end of the connector and another shape, that connection is broken. If the end of the connector isn't already positioned at the specified connecting site, this method moves the end of the connector to the connecting site and adjusts the size and position of the connector.

When you attach a connector to an object, the size and position of the connector are automatically adjusted if necessary.

Use the BeginConnect method to attach the beginning of the connector to a shape.

Example

This example adds two rectangles to the first page in the active publication and connects them with a curved connector. Note that the RerouteConnections method overrides the values you supply for the ConnectionSite arguments used with the BeginConnect and EndConnect methods.

Copy code Copy code
Dim shpRect1 As Shape
Dim shpRect2 As Shape

With ActiveDocument.Pages(1).Shapes

 ' Add two new rectangles.
 Set shpRect1 = .AddShape(Type:=msoShapeRectangle, _
 Left:=100, Top:=50, Width:=200, Height:=100)
 Set shpRect2 = .AddShape(Type:=msoShapeRectangle, _
 Left:=300, Top:=300, Width:=200, Height:=100)

 ' Add a new curved connector.
 With .AddConnector(Type:=msoConnectorCurve, _
 BeginX:=0, BeginY:=0, EndX:=100, EndY:=100) _
 .ConnectorFormat

 ' Connect the new connector to the two rectangles.
 .BeginConnect ConnectedShape:=shpRect1, ConnectionSite:=1
 .EndConnect ConnectedShape:=shpRect2, ConnectionSite:=1

 ' Reroute the connector to create the shortest path.
 .Parent.RerouteConnections
 End With

End With


ShapeRange.GroupItems Property (Publisher)

 Copy code hover
[image]

ShapeRange.GroupItems Property (Publisher)
Send feedback

Returns a GroupShapes collection if the specified shape is a group.

Syntax

expression .GroupItems

expression A variable that represents a ShapeRange object.

Remarks

All smart objects will be treated as grouped shapes.

Example

This example adds three triangles to a publication, groups them, sets a color for the entire group, and then changes the color for the second triangle only.

Copy code Copy code
Sub Grouper()

 Dim docSheet As Document

 Set docSheet = ActiveDocument
 With docSheet.MasterPages.Item(1).Shapes
 ' Add the 3 triangles
 .AddShape(Type:=msoShapeIsoscelesTriangle, _
 Left:=10, Top:=10, Width:=100, Height:=100).Name = "shpOne"
 .AddShape(Type:=msoShapeIsoscelesTriangle, _
 Left:=150, Top:=10, Width:=100, Height:=100).Name = "shpTwo"
 .AddShape(Type:=msoShapeIsoscelesTriangle, _
 Left:=300, Top:=10, Width:=100, Height:=100).Name = "shpThree"
 ' Group and fill the 3 triangles
 With .Range(Array("shpOne", "shpTwo", "shpThree")).Group
 .Fill.PresetTextured msoTextureBlueTissuePaper
 .GroupItems(2).Fill.PresetTextured msoTextureGreenMarble
 End With
 End With

End Sub


HeaderFooter Object (Publisher)

 Copy code hover
[image]

HeaderFooter Object (Publisher)
Send feedback

Represents the header or footer of a master page.

Example

Use MasterPages.Header or MasterPages.Footer to return a HeaderFooter object. The following example adds text to the header of the first master page of the active document.

Copy code Copy code
Dim objHeader As HeaderFooter
Set objHeader = ActiveDocument.MasterPages(1).Header
objHeader.TextRange.Text = "Master Page 1 Header"

Use HeaderFooter.Delete to delete any existing content from a header or footer. Calling this method does not delete the text frame, just the contents of it. The following example deletes all of the header and footer content of all the master pages in a publication.

Copy code Copy code
Dim objMasterPage As page
For Each objMasterPage In ActiveDocument.masterPages
 objMasterPage.Header.Delete
 objMasterPage.Footer.Delete
Next

Use HeaderFooter.TextRange to return a TextRange object representing the header or footer of a master page. Any header or footer content manipulation is done with through this property of the HeaderFooter object. The following example first deletes any existing content and then adds some boilerplate text to the header of a master page.

Copy code Copy code
Dim objHeader As HeaderFooter
Set objHeader = ActiveDocument.MasterPages(1).Header
With objHeader
 .Delete
 .TextRange.Text = "<Insert Address Here>"
End With


ConnectorFormat.BeginConnect Method (Publisher)

 Copy code hover
[image]

ConnectorFormat.BeginConnect Method (Publisher)
Send feedback

Attaches the beginning of the specified connector to a specified shape.

Syntax

expression .BeginConnect(ConnectedShape, ConnectionSite)

expression A variable that represents a ConnectorFormat object.

Parameters

Name | Required/Optional | Data Type | Description
ConnectedShape | Required | Shape | The shape to which Microsoft Publisher attaches the beginning of the connector. The specified Shape object must be in the same Shapes collection as the connector.
ConnectionSite | Required | Long | A connection site on the shape specified by ConnectedShape. Must be an integer between 1 and the integer returned by the ConnectionSiteCount property of the specified shape. Connection sites are numbered starting from the top of the specified shape and moving counterclockwise around the shape. If you want the connector to automatically find the shortest path between the two shapes it connects, specify any valid integer for this argument and then use the RerouteConnections method after the connector is attached to shapes at both ends.

Remarks

If there's already a connection between the beginning of the connector and another shape, that connection is broken. If the beginning of the connector isn't already positioned at the specified connecting site, this method moves the beginning of the connector to the connecting site and adjusts the size and position of the connector.

When you attach a connector to an object, the size and position of the connector are automatically adjusted if necessary.

Use the EndConnect method to attach the end of the connector to a shape.

Example

This example adds two rectangles to the first page in the active publication and connects them with a curved connector. Note that the RerouteConnections method overrides the values you supply for the ConnectionSite arguments used with the BeginConnect and EndConnect methods.

Copy code Copy code
Dim shpRect1 As Shape
Dim shpRect2 As Shape

With ActiveDocument.Pages(1).Shapes

 ' Add two new rectangles.
 Set shpRect1 = .AddShape(Type:=msoShapeRectangle, _
 Left:=100, Top:=50, Width:=200, Height:=100)
 Set shpRect2 = .AddShape(Type:=msoShapeRectangle, _
 Left:=300, Top:=300, Width:=200, Height:=100)

 ' Add a new curved connector.
 With .AddConnector(Type:=msoConnectorCurve, _
 BeginX:=0, BeginY:=0, EndX:=100, EndY:=100) _
 .ConnectorFormat

 ' Connect the new connector to the two rectangles.
 .BeginConnect ConnectedShape:=shpRect1, ConnectionSite:=1
 .EndConnect ConnectedShape:=shpRect2, ConnectionSite:=1

 ' Reroute the connector to create the shortest path.
 .Parent.RerouteConnections
 End With

End With


Printer.IsDuplex Property (Publisher)

 Copy code hover
[image]

Printer.IsDuplex Property (Publisher)
Send feedback

Returns True if the device represented by the parent Printer object is a duplex printer. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .IsDuplex

expression A variable that represents a Printer object.

Return Value

Boolean


Shape.Application Property (Publisher)

 Copy code hover
[image]

Shape.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a Shape object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Document.BeforeClose Event (Publisher)

 Copy code hover
[image]

Document.BeforeClose Event (Publisher)
Send feedback

Occurs immediately before any open document closes.

Syntax

expression .BeforeClose(Cancel)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the document doesn't close when the procedure is finished.

Remarks

For more information about using events with the Document object, see Using Events with the Document Object.

Example

This example prompts the user for a yes or no response before closing a document. For this example to work, you must place this code into the ThisDocument module.

Copy code Copy code
Private Sub Document_BeforeClose(Cancel As Boolean)
 Dim intResponse As Integer

 intResponse = MsgBox("Do you really want to close " _
 & "the document?", vbYesNo)

 If intResponse = vbNo Then Cancel = True
End Sub


Document Members (Publisher)

 Copy code hover
[image]

Document Members (Publisher)
Send feedback

Represents a publication.

Events

Name | Description
BeforeClose | Occurs immediately before any open document closes.
Open | Occurs when a publication is opening.
Redo | Occurs when reversing the last action that was undone.
ShapesAdded | Occurs when one or more new shapes are added to a publication. This event occurs whether shapes are added manually or programmatically.
ShapesRemoved | Occurs when a shape is deleted from a publication.
Undo | Occurs when a user undoes the last action performed.
WizardAfterChange | Occurs after the user chooses an option in the wizard pane that changes any of the following settings in the publication: page layout (page size, fold type, orientation, label product), print setup (paper size, print tiling), adding or deleting objects, adding or deleting pages, or object or page formatting (size, position, fill, border, background, default text, text formatting).

Methods

Name | Description
BeginCustomUndoAction | Specifies the starting point and label (textual description) of a group of actions that are wrapped to create a single undo action. The EndCustomUndoAction method is used to specify the endpoint of the actions used to create the single undo action. The wrapped group of actions can be undone with a single undo.
ChangeDocument | Changes the current publication to one that uses the wizard, and optionally the design, that you specify.
Close | Closes the current publication and creates a blank publication in its place.
ConvertPublicationType | Converts the specified publication to the specified publication type.
EndCustomUndoAction | Specifies the endpoint of a group of actions that are wrapped to create a single undo action. The BeginCustomUndoAction Method method is used to specify the starting point and label (textual description) of the actions used to create the single undo action. The wrapped group of actions can be undone with a single undo.
ExportAsFixedFormat | Saves a Microsoft Publisher publication in PDF or XPS format. The conversion readies the document to be sent to commercial presses, to copy shops, for desktop printing, or for electronic distribution.
FindShapeByWizardTag | Returns a ShapeRange object representing one or all of the shapes placed in a publication by a wizard and bearing the specified wizard tag.
FindShapesByTag | Returns a ShapeRange object that represents the shapes with the specified tag.
PrintOutEx | Prints all or part of the specified publication.
Redo | Redoes the last action or a specified number of actions. Corresponds to the list of items that appears when you click the arrow beside the Redo button on the Standard toolbar. Calling this method reverses the Undo Method method.
Save | Saves the specified publication.
SaveAs | Saves the specified publication with a new name or format.
SetBusinessInformation | Applies the specified business information set, which consists of a logo image and business contact information (such as the company name and address), to the current publication.
Undo | Undoes the last action or a specified number of actions. Corresponds to the list of items that appears when you click the arrow beside the Undo button on the Standard toolbar.
UndoClear | Clears the list of actions that can be undone for the specified publication. Corresponds to the list of items that appears when you click the arrow beside the Undo button on the Standard toolbar.
UpdateOLEObjects | Updates linked and embedded OLE objects.
WebPagePreview | Generates a Web page preview of the specified publication in Internet Explorer.

Properties

Name | Description
ActiveView | Returns a View object representing the view attributes for the specified document. Read-only.
ActiveWindow | Returns a Window object that represents the window with the focus. Because Microsoft Publisher only has one window, there is only one Window object to return.
AdvancedPrintOptions | Returns an AdvancedPrintOptions object that represents the advanced print settings for a publication. Read-only.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
AvailableBuildingBlocks | Returns the available members of the BuildingBlocks collection of the current document. Read-only.
BorderArts | Returns a BorderArts collection that represents the BorderArt types available for use in the specified publication. Read-only.
ColorScheme | Returns or sets the ColorScheme object that represents the scheme colors for the specified publication. Read/write.
DefaultTabStop | Returns or sets a Variant corresponding to the default tab stop for all text in the active publication. Valid range is 1 to 1584 points (0.014" to 22"). Once set, numeric values are considered to be in points. String values may be in any unit supported by Microsoft Publisher. Point values are always returned. If values are outside the valid range, an error is returned. Read/write.
DocumentDirection | Returns or sets a PbDirectionType constant that indicates whether text in the document is read from left to right or from right to left. Read/write.
EnvelopeVisible | Returns or sets a Boolean indicating whether the e-mail message header is visible in the publication window. Read/write.
Find |
FullName | Returns a String representing the full file name of the saved active publication, including its path and file name. Read-only.
IsDataSourceConnected | True if the specified publication is connected to a data source. Read-only.
IsWizard | Returns True if the specified publication is a publication generated by a Microsoft Publisher wizard. Read-only Boolean.
LayoutGuides | Returns a LayoutGuides object consisting of the margin and grid layout guides for all pages including master pages in the publication.
MailEnvelope | Returns an MsoEnvelope object that represents an e-mail header for a publication.
MailMerge | Returns a MailMerge object that represents the mail merge functionality for the specified publication.
MasterPages | Returns the MasterPages collection for the specified publication.
Name | Returns a String value indicating the name of the specified object. Read-only.
Pages | Returns a Pages collection representing all the pages in the specified publication.
PageSetup | Returns a PageSetup object representing a publication's page size, page layout and paper settings. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Path | Returns a String indicating the full path to the file of the saved active publication, not including the last separator or file name.
PrintPageBackgrounds | Returns or sets True to include page backgrounds when printing pages from the specified publication. Default is True. Read/write Boolean.
PrintStyle | Read-only
PublicationType | Returns a PbPublicationType constant that represents the type of the specified publication. Read-only.
ReadOnly | Returns True if the publication is read-only; returns False if it is read/write. Read-only Boolean.
RedoActionsAvailable | Returns the number of actions available on the redo stack. Read-only Long.
RemovePersonalInformation | Returns or sets a Boolean that represents whether to save personal information when the file is saved. Read/write.
Saved | Returns True if no changes have been made to a publication since it was last saved. Read-only Boolean.
SaveFormat | Indicates the file format of the specified document. Read-only.
ScratchArea | Returns a ScratchArea object for an a given document.
Sections | Returns a Sections object representing a collection of Section objects in the specified document. Read-only Sections.
Selection | Returns a Selection object that represents a selected range or the cursor.
Stories | Returns a Stories collection containing all stories in the publication.
SurplusShapes | Returns a ShapeRange object that represents the collection of surplus shapes that Microsoft Publisher places under Extra Content in the Format Publication task pane after the document template (wizard) is changed by using the Document.ChangeDocument method or by using the Change Template command in the user interface. Read-only.
Tags | Returns a Tags collection representing tags or custom properties applied to a shape, shape range, page, or publication.
TextStyles | Returns a TextStyles collection that contains a publication's text styles.
UndoActionsAvailable | Returns the number of actions available on the undo stack. Read-only Long.
ViewBoundaries | Returns True if object boundaries are visible in the specified publication. Read/write Boolean.
ViewGuides | Returns True if guides are visible in the specified publication. Read/write Boolean.
ViewHorizontalBaseLineGuides | Sets or returns a Boolean that represents whether or not the horizontal baseline guides are visible in the specified Document object. True if they are visible. False if they are not visible. Read/write.
ViewTwoPageSpread | Returns True if the specified publication should be viewed as a two-page spread. Read/write Boolean.
ViewVerticalBaseLineGuides | Sets or returns a Boolean that represents whether or not the vertical baseline guides are visible in the specified Document object. True if they are visible. False if they are not visible. Read/write.
WebNavigationBarSets | Returns a WebNavigationBarSets object representing a collection of all WebNavigationBarSet objects in the specified document. Read-only.
Wizard | Returns a Wizard object representing the publication design associated with the specified publication or the wizard associated with the specified Design Gallery object.


Shapes.AddPolyline Method (Publisher)

 Copy code hover
[image]

Shapes.AddPolyline Method (Publisher)
Send feedback

Adds a new Shape object representing an open polyline or a closed polygon to the specified Shapes collection.

Syntax

expression .AddPolyline(SafeArrayOfPoints)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
SafeArrayOfPoints | Required | Variant | An array of coordinate pairs that specifies the polyline's or polygon's vertices.

Return Value

Shape

Remarks

For the array elements in SafeArrayOfPoints, numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

To form a closed polygon, assign the same coordinates to the first and last vertices in the polyline drawing.

Example

The following example adds a triangle to the first page of the active publication. Because the first and last points have the same coordinates, the polygon is closed.

Copy code Copy code
Dim shpPolyline As Shape
Dim arrPoints(1 To 4, 1 To 2) As Single

arrPoints(1, 1) = 25
arrPoints(1, 2) = 100
arrPoints(2, 1) = 100
arrPoints(2, 2) = 150
arrPoints(3, 1) = 150
arrPoints(3, 2) = 50
arrPoints(4, 1) = 25
arrPoints(4, 2) = 100

Set shpPolyline = ActiveDocument.Pages(1).Shapes.AddPolyline _
 (SafeArrayOfPoints:=arrPoints)


TextFrame Properties (Publisher)

 Copy code hover
[image]

TextFrame Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
AutoFitText | Sets or returns a PbTextAutoFitType constant that represents how Microsoft Publisher automatically adjusts the text font size and the TextFrame objects size for best viewing. Read/write.
Columns | Returns or sets a Long that represents the number of guide columns on a page or the number of columns in a text frame. Read/write.
ColumnSpacing | Returns or sets a Variant that represents the amount of space between text columns. Read/write.
HasNextLink | Indicates whether the specified text frame has a valid forward text-box link. Read-only.
HasPreviousLink | Returns msoTrue if the specified text frame has a valid link to a backward text box and msoFalse if it does not. Read-only.
HasText | Returns an MsoTriState constant indicating whether the specified shape has text associated with it. Read-only.
IncludeContinuedFromPage | Determines whether the text "Continued from page pagenumber" appears in a text box when Microsoft Publisher links text boxes. Read/write.
IncludeContinuedOnPage | Determines whether the text "Continued on page pagenumber" appears in a text box when Microsoft Publisher links text boxes. Read/write.
MarginBottom | Returns or sets a Variant that represents the amount of space (in points) between the text and the bottom edge of a cell, text frame, or page. Read/write.
MarginLeft | Returns or sets a Variant that represents the amount of space (in points) between the text and the left edge of a cell, text frame, or page. Read/write.
MarginRight | Returns or sets a Variant that represents the amount of space (in points) between the text and the right edge of a cell, text frame, or page. Read/write.
MarginTop | Returns or sets a Variant that represents the amount of space (in points) between the text and the top edge of a cell, text frame, or page. Read/write.
NextLinkedTextFrame | Returns or sets a TextFrame object representing the text frame to which text flows from the specified text frame. Read/write.
Orientation | Returns or sets a PbTextOrientation constant that represents how text flows in a text box. Read/write.
Overflowing | Indicates whether the text frame contains more text than can fit into the text frame. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
PreviousLinkedTextFrame | Returns a TextFrame object representing the text frame from which text flows to the specified text frame.
Story | Returns a Story object that represents the story properties in a text range.
TextRange | Returns a TextRange object that represents the text that is attached to a shape, and properties and methods for manipulating the text.
VerticalTextAlignment | Returns or sets a PbVerticalTextAlignmentType constant that represents the vertical alignment of text in a text box. Read/write.


ParagraphFormat.KashidaPercentage Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.KashidaPercentage Property (Publisher)
Send feedback

Returns or sets a Long indicating the percentage by which kashidas are to be lengthened for the specified paragraphs. Valid values are from 0 to 100. Read/write.

Syntax

expression .KashidaPercentage

expression A variable that represents a ParagraphFormat object.

Return Value

Long

Remarks

The Alignment property of the specified paragraphs must be set to pbParagraphAlignmentKashida or the KashidaPercentage property is ignored.

Example

The following example sets the paragraphs in shape one on page one of the active publication to kashida alignment and specifies that kashidas are to be lengthened by 20 percent.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.ParagraphFormat
 .Alignment = pbParagraphAlignmentKashida
 .KashidaPercentage = 20
End With


WizardProperty.Name Property (Publisher)

 Copy code hover
[image]

WizardProperty.Name Property (Publisher)
Send feedback

Returns a String value indicating the name of the specified object. Read-only.

Syntax

expression .Name

expression A variable that represents a WizardProperty object.

Remarks

You can use an object's name in conjunction with the Item method or Item property to return a reference to the object if the Item method or property for the collection that contains the object takes a Variant argument. For example, if the value of the Name property for a shape is Rectangle 2, then .Shapes("Rectangle 2") will return a reference to that shape.

The Name property is the default property for the BorderArt, BorderArtFormat, and Label objects.


TextRange.MajorityParagraphFormat Property (Publisher)

 Copy code hover
[image]

TextRange.MajorityParagraphFormat Property (Publisher)
Send feedback

Returns a ParagraphFormat object that represents the paragraph formatting applied to most of the paragraphs in a text range.

Syntax

expression .MajorityParagraphFormat

expression A variable that represents a TextRange object.

Return Value

ParagraphFormat

Example

This example applies the paragraph formatting applied to a majority of the paragraphs in the first shape to the paragraphs in the second shape on the first page of the active document. This example assumes that there are at least two shapes on page one of the active publication.

Copy code Copy code
Sub SetFontName()
 Dim fmt As ParagraphFormat
 With ActiveDocument.Pages(1)
 Set fmt = .Shapes(1).TextFrame.TextRange _
 .MajorityParagraphFormat
 .Shapes(2).TextFrame.TextRange.ParagraphFormat = fmt
 End With
End Sub


ShapeRange.SaveAsBuildingBlock Method (Publisher)

 Copy code hover
[image]

ShapeRange.SaveAsBuildingBlock Method (Publisher)
Send feedback

Saves a single shape range as a building block. Returns the resulting BuildingBlock object.

Version Information

Version Added: Publisher 2010

Syntax

expression .SaveAsBuildingBlock(Name)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the new building block you want to create.


Sections Members (Publisher)

 Copy code hover
[image]

Sections Members (Publisher)
Send feedback

A collection of all the Section objects in the document.

Methods

Name | Description
Add | Adds a new Section object to the specified Sections collection and returns the new Section object.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Item | Returns an individual object from a specified collection. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


ThreeDFormat.SetThreeDFormat Method (Publisher)

 Copy code hover
[image]

ThreeDFormat.SetThreeDFormat Method (Publisher)
Send feedback

Sets the preset extrusion format. Each preset extrusion format contains a set of preset values for the 3-D properties of the extrusion.

Syntax

expression .SetThreeDFormat(PresetThreeDFormat)

expression A variable that represents a ThreeDFormat object.

Parameters

Name | Required/Optional | Data Type | Description
PresetThreeDFormat | Required | MsoPresetThreeDFormat | Specifies a preset extrusion format that corresponds to one of the options (numbered from left to right, from top to bottom) displayed when you click the 3-D button on the Drawing toolbar.

Remarks

This method sets the PresetThreeDFormat property to the format specified by the PresetThreeDFormat argument.

The PresetThreeDFormat parameter can be one of the MsoPresetThreeDFormat constants declared in the Microsoft Office type library and shown in the following table.

msoThreeD1

msoThreeD2

msoThreeD3

msoThreeD4

msoThreeD5

msoThreeD6

msoThreeD7

msoThreeD8

msoThreeD9

msoThreeD10

msoThreeD11

msoThreeD12

msoThreeD13

msoThreeD14

msoThreeD15

msoThreeD16

msoThreeD17

msoThreeD18

msoThreeD19

msoThreeD20

Example

This example adds an oval to the active publication and sets its extrusion format to one of the preset 3-D formats.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes _
 .AddShape(Type:=msoShapeOval, _
 Left:=30, Top:=30, Width:=50, Height:=25).ThreeD
 .Visible = True
 .SetThreeDFormat PresetThreeDFormat:=msoThreeD12
End With


Shapes.CanvasArrangementType Property (Publisher)

 Copy code hover
[image]

Shapes.CanvasArrangementType Property (Publisher)
Send feedback

A pbCanvasArrangementType constant that specifies the arrangement type of the canvas. Read/write.

Version Information

Version Added: Publisher 2010

Syntax

expression .CanvasArrangementType

expression A variable that represents a Shapes object.


Selection.ShapeRange Property (Publisher)

 Copy code hover
[image]

Selection.ShapeRange Property (Publisher)
Send feedback

Returns a ShapeRange collection that represents all the Shape objects in the specified range or selection. The shape range can contain drawings, shapes, pictures, OLE objects, ActiveX controls, text objects, and callouts.

Syntax

expression .ShapeRange

expression A variable that represents a Selection object.

Return Value

ShapeRange

Example

The following example sets the fill pattern for all the shapes in the selection. This example assumes one or more shapes are selected in the active publication.

VBA Copy code Copy code
Sub ChangeFillForShapeRange()
 Selection.ShapeRange.Fill.Patterned Pattern:=msoPattern20Percent
End Sub

The following example applies shadow and fill formatting to all the shapes in the selection. This example assumes one or more shapes are selected in the active publication.

VBA Copy code Copy code
Sub SetShadowForSelectedShapes()
 With Selection.ShapeRange
 .Shadow.Type = msoShadow6
 .Fill.Patterned Pattern:=msoPatternDottedDiamond
 End With
End Sub


FillFormat.PresetGradient Method (Publisher)

 Copy code hover
[image]

FillFormat.PresetGradient Method (Publisher)
Send feedback

Sets the specified fill to a preset gradient.

Syntax

expression .PresetGradient(Style, Variant, PresetGradientType)

expression A variable that represents a FillFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | MsoGradientStyle | The style of the gradient.
Variant | Required | Long | The gradient variant. Can be a value from 1 to 4, corresponding to the four variants on the Gradient tab in the Fill Effects dialog box. If Style is msoGradientFromTitle or msoGradientFromCenter, this argument can be either 1 or 2.
PresetGradientType | Required | MsoPresetGradientType | The gradient type.

Remarks

The Style parameter can be one of the MsoPresetGradientStyle constants declared in the Microsoft Office type library and shown in the following table.

msoGradientDiagonalDown

msoGradientDiagonalUp

msoGradientFromCenter

msoGradientFromCorner

msoGradientFromTitle

msoGradientHorizontal

msoGradientVertical

The PresetGradientType parameter can be one of the MsoPresetGradientType constants declared in the Microsoft Office type library and shown in the following table.

msoGradientBrass

msoGradientCalmWater

msoGradientChrome

msoGradientChromeII

msoGradientDaybreak

msoGradientDesert

msoGradientEarlySunset

msoGradientFire

msoGradientFog

msoGradientGold

msoGradientGoldII

msoGradientHorizon

msoGradientLateSunset

msoGradientMahogany

msoGradientMoss

msoGradientNightfall

msoGradientOcean

msoGradientParchment

msoGradientPeacock

msoGradientRainbow

msoGradientRainbowII

msoGradientSapphire

msoGradientSilver

msoGradientWheat

Example

This example adds a rectangle with a preset gradient fill to the active publication.

VBA Copy code Copy code
ActiveDocument.Pages(1).Shapes _
 .AddShape(msoShapeRectangle, 90, 90, 140, 80) _
 .Fill.PresetGradient Style:=msoGradientHorizontal, _
 Variant:=1, PresetGradientType:=msoGradientBrass


PictureFormat.Height Property (Publisher)

 Copy code hover
[image]

PictureFormat.Height Property (Publisher)
Send feedback

Returns a Variant that represents the height, in points, of the specified picture or OLE object. Read-only.

Syntax

expression .Height

expression A variable that represents a PictureFormat object.

Remarks

The valid range for the Height property depends on the size of the application workspace and the position of the object within the workspace. For centered objects on non-banner page sizes, the Height property may be 0.0 to 50.0 inches. For centered objects on banner page sizes, the Height property may be 0.0 to 241.0 inches.


AdvancedPrintOptions.VerticalFlip Property (Publisher)

 Copy code hover
[image]

AdvancedPrintOptions.VerticalFlip Property (Publisher)
See also Send feedback

True to print a vertically mirrored image of the specified publication. The default is False. Read/write Boolean.

Syntax

expression .VerticalFlip

expression A variable that represents an AdvancedPrintOptions object.

Remarks

This property is accessible only if the active printer is a PostScript printer. Returns a run-time error if a non-PostScript printer is specified. Use the IsPostscriptPrinter property of the AdvancedPrintOptions object to determine if the specified printer is a PostScript printer.

This property is saved as an application setting and applied to future instances of Microsoft Publisher.

This property corresponds to the Flip vertically control on the Page Settings tab of the Advanced Print Settings dialog box.

This property is mostly used when printing to film on an imagesetter so that the image reads correctly when the emulsion side of the film is down (as when burning a press plate).

Example

The following example determines if the active printer is a PostScript printer. If it is, the active publication is set to print as a horizontally mirrored and vertically mirrored, negative image of itself.

VBA Copy code Copy code
Sub PrepToPrintToFilmOnImagesetter()

With ActiveDocument.AdvancedPrintOptions
 If .IsPostscriptPrinter = True Then
 .HorizontalFlip = True
 .VerticalFlip = True
 .NegativeImage = True
 End If
End With

End Sub

See also

Concepts

AdvancedPrintOptions Object

Other resources

AdvancedPrintOptions Object Members


Application.ScreenUpdating Property (Publisher)

 Copy code hover
[image]

Application.ScreenUpdating Property (Publisher)
See also Send feedback

Returns or sets a Boolean indicating whether Microsoft Publisher refreshes the screen display during run time; True to refresh the screen display. Read/write.

Syntax

expression .ScreenUpdating

expression A variable that represents a Application object.

Return Value

Boolean

Remarks

Turning screen updating off during run time can speed execution of Microsoft Visual Basic code. However, we recommend that you provide some indication of status so that the user is aware that the program is functioning correctly.

Example

The following example turns off screen updating at the beginning of a subroutine and turns it back on at the end of the subroutine.

VBA Copy code Copy code
Sub TurnOffScreenUpdating()
 ScreenUpdating = False

 ' Execute code here.

 ScreenUpdating = True
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


PhoneticGuide.FontName Property (Publisher)

 Copy code hover
[image]

PhoneticGuide.FontName Property (Publisher)
Send feedback

Returns a String that represents the name of the font applied to phonetic information displayed above Japanese text. Read-only.

Syntax

expression .FontName

expression A variable that represents a PhoneticGuide object.


ParagraphFormat.CharBasedFirstLineIndent Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.CharBasedFirstLineIndent Property (Publisher)
Send feedback

Returns or sets the value of the first line indent (in East Asian character width). Read/write Long.

Syntax

expression .CharBasedFirstLineIndent

expression A variable that represents a ParagraphFormat object.

Return Value

Long

Remarks

The value of CharBasedFirstLineIndent can be returned or set only after the UseCharBasedFirstLineIndent has been set. A run-time "permission denied" error is returned if UseCharBasedFirstLineIndent is not set first. Note, however, that UseCharBasedFirstLineIndent can be set only if East Asian languages are enabled on the client computer (the value can be returned regardless of whether East Asian languages are enabled). This effectively means that CharBasedFirstLineIndent cannot be used unless East Asian languages are enabled on the client computer.

The value of CharBasedFirstLineIndent can range from 0 (zero) to 80.

Example

The following example creates a text box on the fourth page of the active publication. After the UseCharBasedFirstLineIndent property is set to True, the width of the first line indent is set to 15 points by using the CharBasedFirstLineIndent property. Font properties are then set, and text is inserted into the paragraph.

Copy code Copy code
Dim theTextBox As Shape

Set theTextBox = ActiveDocument.Pages(4).Shapes _
 .AddShape(msoShapeRectangle, 100, 100, 300, 200)

With theTextBox
 .TextFrame.TextRange.ParagraphFormat _
 .UseCharBasedFirstLineIndent = msoTrue
 .TextFrame.TextRange.ParagraphFormat _
 .CharBasedFirstLineIndent = 15
 .TextFrame.TextRange.Font.Name = "Verdana"
 .TextFrame.TextRange.Font.Size = 12
 .TextFrame.TextRange.Text = "This is a test sentence." _
 & Chr(13) & "This is another test sentence."
End With


ColorSchemes.Parent Property (Publisher)

 Copy code hover
[image]

ColorSchemes.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a ColorSchemes object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Attachments Methods (Publisher)

 Copy code hover
[image]

Attachments Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Add | Adds an Attachment object to the Attachments collection of a Microsoft Publisher publication.
ClearAll | Clears (deletes) all the Attachment objects in the parent Attachments collection of an e-mail merge message.


Attachment Object (Publisher)

 Copy code hover
[image]

Attachment Object (Publisher)
See also Send feedback

Represents an attachment to a merged e-mail message.

Version Information

Version Added: Publisher 2007

Remarks

An Attachment object corresponds to one of the attachments in the list of attachments in the Attachments box in the Merge to E-mail dialog box in the Microsoft Publisher user interface. (On the File menu, point to Send E-mail, click Send E-mail Merge, and then click Options.)

To remove the attachment from the merged e-mail, use the Delete method of the Attachment object.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the Add method to add an attachment to an e-mail merge message. It adds an Attachment object that represents a bitmap image to the Attachments collection of the active document.

Before running this macro, place a file named image.bmp in the root of the C drive on your computer, or change the name and file path of the file in the macro to specify the one you want to attach.

Note that to send an e-mail merge message, you must connect to a data source, create the e-mail merge, and then send the message. For more information, see the EmailMergeEnvelope object topic.

VBA Copy code Copy code
Public Sub Attachment_Example()

 Dim pubAttachments As Publisher.Attachments
 Dim pubAttachment As Publisher.Attachment
 Dim pubMailMerge As Publisher.MailMerge
 Dim pubEmailMergeEnvelope As Publisher.EmailMergeEnvelope

 Set pubMailMerge = ThisDocument.MailMerge
 Set pubEmailMergeEnvelope = pubMailMerge.EmailMergeEnvelope
 Set pubAttachments = pubEmailMergeEnvelope.Attachemts

 Set pubAttachment = pubAttachments.Add("C:\image.bmp")

End Sub

See also

Other resources

Attachment Object Members


Selection.TableCellRange Property (Publisher)

 Copy code hover
[image]

Selection.TableCellRange Property (Publisher)
Send feedback

Returns a CellRange object that represents the cells in a table selection.

Syntax

expression .TableCellRange

expression A variable that represents a Selection object.

Return Value

CellRange

Example

This example fills the table cells in a selection.

VBA Copy code Copy code
Sub FillTableCellRange()
 Dim intCount As Integer
 With Selection
 If .Type = pbSelectionTableCells Then
 With .TableCellRange
 For intCount = 1 To .Count
 .Item(intCount).Fill.ForeColor.RGB = RGB _
 (Red:=0, Green:=255, Blue:=255)
 Next intCount
 End With
 End If
 End With
End Sub


ReaderSpread.Width Property (Publisher)

 Copy code hover
[image]

ReaderSpread.Width Property (Publisher)
Send feedback

Returns a Single that represents the width, in points, of the page. Read-only.

Syntax

expression .Width

expression A variable that represents a ReaderSpread object.


Shape.Cut Method (Publisher)

 Copy code hover
[image]

Shape.Cut Method (Publisher)
Send feedback

Deletes the specified object and places it on the Clipboard.

Syntax

expression .Cut

expression A variable that represents a Shape object.

Remarks

Use the Paste method to paste the contents of the Clipboard.

The Copy method can be used on Shape objects, but the Paste method cannot.

Example

This example deletes shape one and shape two from page one of the active publication, places copies of them on the Clipboard, and then pastes the copies onto page two.

Copy code Copy code
With ActiveDocument
 .Pages(1).Shapes.Range(Array(1, 2)).Cut
 .Pages(2).Shapes.Paste
End With

This example deletes shape one on page one of the active publication and places a copy of it on the Clipboard.

Copy code Copy code
ActiveDocument
Copy code Copy code
.Pages(1).Shapes(1).Cut

This example deletes the text in shape one on page one of the active publication and places a copy of it on the Clipboard.

Copy code Copy code
ActiveDocument
Copy code Copy code
.Pages(1).Shapes(1).TextFrame.TextRange.Cut


Application.CaptionStyles Property (Publisher)

 Copy code hover
[image]

Application.CaptionStyles Property (Publisher)
Send feedback

Returns a CaptionStyles collection that represents all the available caption styles. Read-only.

Syntax

expression .CaptionStyles

expression A variable that represents a Application object.

Return Value

CaptionStyles


Shapes.AddBuildingBlock Method (Publisher)

 Copy code hover
[image]

Shapes.AddBuildingBlock Method (Publisher)
Send feedback

Adds a BuildingBlock object and returns a Shape object on the page that represents the building block.

Syntax

expression .AddBuildingBlock(BBlockIn, Left, Top)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | BuildingBlock | The building block to return as a shape.
Left | Required | Variant | The position of the left edge of the shape that represents the building block.
Top | Required | Variant | The position of the top edge of the shape that represents the building block.

Return Value

Shape


ThreeDFormat.BevelBottomDepth Property (Publisher)

 Copy code hover
[image]

ThreeDFormat.BevelBottomDepth Property (Publisher)
See also Send feedback

Returns or sets a Single that represents the depth of the bottom bevel. Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .BevelBottomDepth

expression A variable that represents a ThreeDFormat object.

Return value

Single

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


Options.ShowBasicColors Property (Publisher)

 Copy code hover
[image]

Options.ShowBasicColors Property (Publisher)
Send feedback

Returns or sets a Boolean indicating whether Microsoft Publisher shows basic colors in the color palette; True to show basic colors in the palette. Read/write.

Syntax

expression .ShowBasicColors

expression A variable that represents a Options object.

Return Value

Boolean

Example

The following example sets Publisher to not show basic colors in the color palette.

VBA Copy code Copy code
Options.ShowBasicColors = False


ShapeRange Methods (Publisher)

 Copy code hover
[image]

ShapeRange Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
AddToCatalogMergeArea | Adds the specified shape or shapes to the publication page's catalog merge area.
Align | Aligns all the shapes in the specified ShapeRange object.
Apply | Applies formatting copied from another shape or shape range using the PickUp method.
Copy | Copies the specified object to the Clipboard.
Cut | Deletes the specified object and places it on the Clipboard.
Delete | Deletes the specified object.
Distribute | Evenly distributes the shapes in the specified shape range.
Duplicate | Creates a duplicate of the specified Shape or ShapeRange object, adds the new shape or range of shapes to the Shapes collection immediately after the shape or range of shapes specified originally, and then returns the new Shape or ShapeRange object.
Flip | Flips the specified shape around its horizontal or vertical axis, or flips all the shapes in the specified shape range around their horizontal or vertical axes.
GetHeight | Returns the height of the shape or shape range as a Single in the specified units.
GetLeft | Returns the distance of the shape's or shape range's left edge from the left edge of the leftmost page in the current view as a Single in the specified units.
GetTop | Returns the distance of the shape's or shape range's top edge from the top edge of the leftmost page in the current view as a Single in the specified units.
GetWidth | Returns the width of the shape or shape range as a Single in the specified units. .
Group | Groups the shapes in the specified shape range. Returns the grouped shapes as a single Shape object.
IncrementLeft | Moves the specified shape or shape range horizontally by the specified distance.
IncrementRotation | Changes the rotation of the specified shape around the z-axis (extends outward from the plane of the publication) by the specified number of degrees.
IncrementTop | Moves the specified shape or shape range vertically by the specified distance.
Item | Returns an individual object in a specified collection.
MoveIntoTextFlow | Moves a given shape into the text flow defined by TextRange Object. The shape will always be inserted inline at the beginning of the text flow.
MoveOutOfTextFlow | Moves a given inline shape out of its containing text range, defined by TextRange Object, and makes the shape fixed.
PickUp | Copies formatting from a shape or shape range so that it can be copied to another shape or shape range using the Apply method.
Regroup | Regroups the group that the specified shape range belonged to previously. Returns the regrouped shapes as a single Shape object.
RemoveFromCatalogMergeArea | Removes a shape from the specified page's catalog merge area. Removed shapes are not deleted, but instead remain in place on the page containing the catalog merge area.
RerouteConnections | Reroutes connectors so that they take the shortest possible path between the shapes they connect. To do this, the RerouteConnections method may detach the ends of a connector and reattach them to different connecting sites on the connected shapes.
SaveAsBuildingBlock | Saves a single shape range as a building block. Returns the resulting BuildingBlock object.
SaveAsPicture | Saves a range of one or more shapes as a picture file.
ScaleHeight | Scales the height of the shape by a specified factor. For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original size or relative to the current size.
ScaleWidth | Scales the width of the shape by a specified factor. For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original size or relative to the current size.
Select | Selects the specified object.
SetShapesDefaultProperties | Applies the formatting for the specified shape or shape range to the default shape. Shapes created after this method has been used will have this formatting applied to them by default.
Ungroup | Ungroups the specified group of shapes or any groups of shapes in the specified shape range. If the specified shape is a picture or OLE object, Microsoft Publisher will break it apart and convert it to an ungrouped set of shapes. (For example, an embedded Microsoft Excel spreadsheet is converted into lines and text boxes.) Returns the ungrouped shapes as a single ShapeRange object.
ZOrder | Moves the specified shape in front of or behind other shapes in the collection (that is, changes the shape's position in the z-order).


Table.GrowToFitText Property (Publisher)

 Copy code hover
[image]

Table.GrowToFitText Property (Publisher)
Send feedback

True for cells in a table to increase vertically to fit text. Read/write.

Syntax

expression .GrowToFitText

expression A variable that represents a Table object.

Return Value

Boolean

Example

This example sets each row of the specified table to 12 points, and the row height doesn't increase as text is added to the cells in the rows.

Copy code Copy code
Sub DontEnlargeTableCells()
 Dim rowTable As Row
 With ActiveDocument.Pages(1).Shapes(1).Table
 .GrowToFitText = False
 For Each rowTable In .Rows
 rowTable.Height = 12
 Next
 End With
End Sub


Document.Parent Property (Publisher)

 Copy code hover
[image]

Document.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a Document object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


WebOptionButton.Value Property (Publisher)

 Copy code hover
[image]

WebOptionButton.Value Property (Publisher)
Send feedback

Returns or sets a String that represents the value of a Web check box or option button. Read/write.

Syntax

expression .Value

expression A variable that represents a WebOptionButton object.


WebOptions.ShowOnlyWebFonts Property (Publisher)

 Copy code hover
[image]

WebOptions.ShowOnlyWebFonts Property (Publisher)
Send feedback

Returns or sets a Boolean value that specifies whether only Web-safe fonts and font schemes should be used when the Web site is viewed in a browser. If True, only Web-safe fonts and font schemes are used. If False, display is not limited to Web-safe fonts and font schemes. The default value is False. Read/write.

Syntax

expression .ShowOnlyWebFonts

expression A variable that represents a WebOptions object.

Return Value

Boolean

Remarks

This property applies to Latin-based fonts only.

Example

The following example specifies that only Web-safe fonts and font schemes should be used when the Web site is viewed in a browser.

VBA Copy code Copy code
Dim theWO As WebOptions

Set theWO = Application.WebOptions

With theWO
 .ShowOnlyWebFonts = True
End With


Shape.Select Method (Publisher)

 Copy code hover
[image]

Shape.Select Method (Publisher)
Send feedback

Selects the specified object.

Syntax

expression .Select(Replace)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Replace | Optional | Variant | Specifies whether the selection replaces any previous selection. True to replace the previous selection with the new selection; False to add the new selection to the previous selection. Default is True.

Example

This example selects shapes one and three on page one in the active publication.

VBA Copy code Copy code
ActiveDocument.Pages(1).Shapes.Range(Array(1, 3)).Select

This example adds shapes two and four on page one in the active publication to the previous selection.

VBA Copy code Copy code
ActiveDocument.Pages(1).Shapes.Range(Array(2, 4)) _
 .Select Replace:=False


PictureFormat.FitFrame Method (Publisher)

 Copy code hover
[image]

PictureFormat.FitFrame Method (Publisher)
Send feedback

Fits the image represented by the PictureFormat object to the frame of the picture. Returns nothing.

Version Information

Version Added: Publisher 2010

Syntax

expression .FitFrame

expression A variable that represents a PictureFormat object.


ThreeDFormat.IncrementRotationX Method (Publisher)

 Copy code hover
[image]

ThreeDFormat.IncrementRotationX Method (Publisher)
Send feedback

Changes the rotation of the specified shape around the x-axis (horizontal) by the specified number of degrees.

Syntax

expression .IncrementRotationX(Increment)

expression A variable that represents a ThreeDFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies by how many degrees to rotate the shape around the x-axis. Can be a value from - 90 through 90. A positive value tilts the shape up; a negative value tilts it down.

Remarks

Use the RotationX property to set the absolute rotation of the shape around the x-axis.

You cannot adjust the rotation around the x-axis of the specified shape past the upper or lower limit for the RotationX property (90 degrees to - 90 degrees). For example, if the RotationX property is initially set to 80 and you specify 40 for the Increment argument, the resulting rotation will be 90 (the upper limit for the RotationX property) instead of 120.

To change the rotation of a shape around the y-axis (vertical), use the IncrementRotationY method. To change the rotation around the z-axis (extends outward from the plane of the publication), use the IncrementRotation method.

Example

This example tilts the first shape in the active publication up 10 degrees. The shape must be an extruded shape for you to see the effect of this code.

Copy code Copy code
ActiveDocument.Pages(1).Shapes(1).ThreeD _
 .IncrementRotationX Increment:=10


Window.Application Property (Publisher)

 Copy code hover
[image]

Window.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a Window object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


RulerGuides Properties (Publisher)

 Copy code hover
[image]

RulerGuides Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Item | Returns an individual object from a specified collection. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Cell.MarginRight Property (Publisher)

 Copy code hover
[image]

Cell.MarginRight Property (Publisher)
Send feedback

Returns or sets a Variant that represents the amount of space (in points) between the text and the right edge of a cell, text frame, or page. Read/write.

Syntax

expression .MarginRight

expression A variable that represents a Cell object.

Example

This example sets the margins of the active publication to two inches.

Copy code Copy code
Sub SetPageMargins()

 With ActiveDocument.LayoutGuides
 .MarginTop = Application.InchesToPoints(Value:=2)
 .MarginBottom = Application.InchesToPoints(Value:=2)
 .MarginLeft = Application.InchesToPoints(Value:=2)
 .MarginRight = Application.InchesToPoints(Value:=2)
 End With

End Sub


MailMergeDataFields.Item Method (Publisher)

 Copy code hover
[image]

MailMergeDataFields.Item Method (Publisher)
Send feedback

Returns a MailMergeDataField object from the specified MailMergeDataFields object.

Syntax

expression .Item(varIndex)

expression A variable that represents a MailMergeDataFields object.

Parameters

Name | Required/Optional | Data Type | Description
varIndex | Required | Variant | The number or name of the field to return.

Return Value

MailMergeDataField


Printer Members (Publisher)

 Copy code hover
[image]

Printer Members (Publisher)
Send feedback

A Printer object represents a printer installed on your computer.

Properties

Name | Description
Application | Returns an Application object that represents the creator of the parent Printer object. Read-only.
DriverType | Specifies the type of driver supported by the printer. Read-only.
Index | Returns a Long that represents the position of a particular printer in a specified printer collection.
IsActivePrinter | Gets or sets the printer represented by the parent Printer object as the active printer. Read/write.
IsColor | Returns True if the device represented by the parent Printer object is a color printer. Read-only.
IsDuplex | Returns True if the device represented by the parent Printer object is a duplex printer. Read-only.
PaperHeight | Gets or sets the height of the printed page in points. Read/write.
PaperOrientation | Gets or sets page orientation (landscape or portrait) for the printer. Read/write.
PaperSize | Returns the paper size setting found on the Publication and Paper Settings tab in the Print Setup dialog box in the Microsoft Publisher user interface (File menu). Read-only.
PaperSource | Returns the paper source setting found on the Publication and Paper Settings tab in the Print Setup dialog box in the Microsoft Publisher user interface (File menu). Read-only.
PaperWidth | Gets or sets the width of a printed page in points. Read/write.
Parent | Returns the parent of the Printer object. Read-only.
PrintableRect | Returns a PrintableRect object that represents the printer sheet area within which the specified printer will print. Read-only.
PrinterName | Gets the name of the printer represented by the parent Printer object. Read-only.
PrintMode | Read/write


Wizard.SetId Method (Publisher)

 Copy code hover
[image]

Wizard.SetId Method (Publisher)
Send feedback

Specifies the type of the wizard (template) to which to convert the current publication type.

Version Information

Version Added: Publisher 2007

Syntax

expression .SetId(ID)

expression A variable that represents a Wizard object.

Parameters

Name | Required/Optional | Data Type | Description
ID | Required | Long | ID of the wizard (template) to which to convert the current publication.

Remarks

When Microsoft Publisher converts the publication type, it automatically maps elements of the existing publication type to the new publication type as best as possible. Any elements that it cannot map appear under Extra Content in the Format Publication task pane in the Publisher user interface; you can add them to the new publication manually by dragging them onto the publication page.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the SetId method to convert the current publication type to a brochure.

VBA Copy code Copy code
Public Sub SetId_Example()

 Wizard.SetId (pbWizardBrochures)

End Sub


Tags Properties (Publisher)

 Copy code hover
[image]

Tags Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Sections.Add Method (Publisher)

 Copy code hover
[image]

Sections.Add Method (Publisher)
Send feedback

Adds a new Section object to the specified Sections collection and returns the new Section object.

Syntax

expression .Add(StartPageIndex)

expression A variable that represents a Sections object.

Parameters

Name | Required/Optional | Data Type | Description
StartPageIndex | Required | Long | The page number of the publication page that the new section begins on.

Return Value

Section


Shapes.CanvasesCount Property (Publisher)

 Copy code hover
[image]

Shapes.CanvasesCount Property (Publisher)
Send feedback

A Long that specifies the number of canvases in the Shapes collection. Read-only.

Version Information

Version Added: Publisher 2010

Syntax

expression .CanvasesCount

expression A variable that represents a Shapes object.


Application.OfficeDataSourceObject Property (Publisher)

 Copy code hover
[image]

Application.OfficeDataSourceObject Property (Publisher)
See also Send feedback

Returns an OfficeDataSourceObject object representing the data source in a mail merge or catalog merge operation. Read-only.

Syntax

expression .OfficeDataSourceObject

expression A variable that represents an Application object.

Return Value

OfficeDataSourceObject

Example

The following example displays information about the current mail merge data source.

VBA Copy code Copy code
Dim odsoTemp As Office.OfficeDataSourceObject

Set odsoTemp = Application.OfficeDataSourceObject

With odsoTemp
 Debug.Print "Connection string: " & .ConnectString
 Debug.Print "Data source: " & .DataSource
 Debug.Print "Table: " & .Table
End With

See also

Concepts

Application Object

Other resources

Application Object Members


MailMergeDataSource.ConnectString Property (Publisher)

 Copy code hover
[image]

MailMergeDataSource.ConnectString Property (Publisher)
Send feedback

Returns a String that represents the connection to the specified mail merge data source. Read-only.

Syntax

expression .ConnectString

expression A variable that represents a MailMergeDataSource object.

Return Value

String

Example

This example checks if the connection string contains the characters OLEDB and displays a message accordingly.

Copy code Copy code
Sub VerifyCorrectDataSource()

 With ActiveDocument.MailMerge.DataSource
 If InStr(.ConnectString, "OLEDB") > 0 Then
 MsgBox "OLE DB is used to connect to the data source."
 Else
 MsgBox "OLE DB is not used to connect to the data source."
 End If
 End With

End Sub


ThreeDFormat.PresetThreeDFormat Property (Publisher)

 Copy code hover
[image]

ThreeDFormat.PresetThreeDFormat Property (Publisher)
Send feedback

Returns an MsoPresetThreeDFormat constant that represents the preset extrusion format. Read-only.

Syntax

expression .PresetThreeDFormat

expression A variable that represents a ThreeDFormat object.

Return Value

MsoPresetThreeDFormat

Remarks

The PresetThreeDFormat property value can be one of the MsoPresetThreeDFormat constants declared in the Microsoft Office type library.

Each preset extrusion format contains a set of preset values for the various properties of the extrusion. If the extrusion has a custom format rather than a preset format, this property returns msoPresetThreeDFormatMixed.

The values for this property correspond to the options (numbered from left to right, top to bottom) displayed when you click the 3-D Style button on the Formatting toolbar.

Use the SetThreeDFormat method to set the preset extrusion format.

Example

This example sets the extrusion format for the first shape on the first page of the active publication to 3-D Style 12 if the shape initially has a custom extrusion format. For this example to work, the specified shape must be a 3-D shape.

VBA Copy code Copy code
Sub SetPreset3D()
 With ActiveDocument.Pages(1).Shapes(1).ThreeD
 If .PresetThreeDFormat = msoPresetThreeDFormatMixed Then
 .SetThreeDFormat msoThreeD12
 End If
 End With
End Sub


ThreeDFormat Members (Publisher)

 Copy code hover
[image]

ThreeDFormat Members (Publisher)
Send feedback

Represents a shape's three-dimensional formatting.

Methods

Name | Description
IncrementRotationX | Changes the rotation of the specified shape around the x-axis (horizontal) by the specified number of degrees.
IncrementRotationY | Changes the rotation of the specified shape around the y-axis (vertical) by the specified number of degrees.
ResetRotation | Resets the extrusion rotation around the x-axis (horizontal) and the y-axis (vertical) to 0 (zero) so that the front of the extrusion faces forward.
SetExtrusionDirection | Sets the direction that the extrusion's sweep path takes away from the extruded shape.
SetThreeDFormat | Sets the preset extrusion format. Each preset extrusion format contains a set of preset values for the 3-D properties of the extrusion.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
BevelBottomDepth | Returns or sets a Single that represents the depth of the bottom bevel. Read/write.
BevelBottomInset | Returns or sets a Single that represents the inset size for the bottom bevel. Read/write.
BevelBottomType | Returns or sets an MsoPresetCamera constant that represents the bevel type for the bottom bevel. Read/write.
BevelTopDepth | Returns or sets a Single that represents the depth of the top bevel. Read/write.
BevelTopInset | Returns or sets a Single that represents the depth of the top bevel. Read/write.
BevelTopType | Returns or sets an MsoPresetCamera constant that represents the bevel type for the top bevel. Read/write.
ContourColor | Returns or sets a ColorFormat object that represents color of the contour of a shape. Read/write.
ContourWidth | Returns or sets a Single that represents the width of the contour of a shape. Read/write.
Depth | Returns or sets a Variant indicating the depth of the shape's extrusion. Read/write.
ExtrusionColor | Returns a ColorFormat object representing the color of the shape's extrusion.
ExtrusionColorType | Returns or sets an MsoExtrusionColorType constant indicating whether the extrusion color is based on the extruded shape's fill (the front face of the extrusion) and automatically changes when the shape's fill changes, or whether the extrusion color is independent of the shape's fill. Read/write.
FieldOfView | Returns or sets a Single that represents the amount of perspective for a shape. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Perspective | msoTrue if the extrusion appears in perspective — that is, if the walls of the extrusion narrow toward a vanishing point. msoFalse if the extrusion is a parallel, or orthographic, projection — that is, if the walls don't narrow toward a vanishing point. Read/write.
PresetExtrusionDirection | Returns an MsoPresetExtrusionDirection constant that represents the direction taken by the extrusion's sweep path leading away from the extruded shape (the front face of the extrusion). Read-only.
PresetLightingDirection | Returns or sets an MsoPresetLightingDirection constant that represents the position of the light source relative to the extrusion. Read/write.
PresetLightingSoftness | Returns or sets a MsoPresetLightingSoftness constant that represents the intensity of the extrusion lighting. Read/write.
PresetMaterial | Returns or sets an MsoPresetMaterial constant that represents the extrusion surface material. Read/write.
PresetThreeDFormat | Returns an MsoPresetThreeDFormat constant that represents the preset extrusion format. Read-only.
RotationX | Returns or sets the rotation of the extruded shape around the x-axis in degrees. Can be a value from - 90 through 90. A positive value indicates upward rotation; a negative value indicates downward rotation. Read/write Single.
RotationY | Returns or sets the rotation of the extruded shape around the y-axis, in degrees. Can be a value from - 90 through 90. A positive value indicates rotation to the left; a negative value indicates rotation to the right. Read/write Single.
Visible | Returns or sets an MsoTriState constant indicating whether the specified object or the formatting applied to the specified object is visible. Read/write.


Options Members (Publisher)

 Copy code hover
[image]

Options Members (Publisher)
Send feedback

Represents application and publication options in Microsoft Publisher. Many of the properties for the Options object correspond to items in the Options dialog box (Tools menu).

Methods

Name | Description
ResetTips | Resets tippages so that a user can view them when using features that have been used before.
ResetWizardSynchronizing | Resets the data that Microsoft Publisher uses to automatically change similar objects to have the same formatting or content.

Properties

Name | Description
AddHebDoubleQuote | True for Microsoft Publisher to display double quotes for Hebrew alphabet numbering. Default is False. Read/write Boolean.
AllowBackgroundSave | True (default) for Microsoft Publisher to save publications in the background, allowing users to perform other actions at the same time. Read/write Boolean.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
AutoFormatWord | True for Microsoft Publisher to automatically format the entire word at the cursor position, even when no text is selected. Read/write Boolean.
AutoHyphenate | True (default) for Microsoft Publisher to automatically hyphenate text in text frames. Read/write Boolean.
AutoKeyboardSwitching | True for Microsoft Publisher to automatically switch the keyboard language to the language used for the text at the cursor position. Read/write Boolean.
AutoSelectWord | True for Microsoft Publisher to automatically select the entire word when selecting text. Read/write Boolean.
DefaultPubDirection | Returns or sets a PbDirectionType constant that represents the default direction in which text flows when a new publication is created. Read/write.
DefaultTextFlowDirection | Returns or sets a PbDirectionType constant that represents a global Microsoft Publisher option, indicating whether text flows from left to right or from right to left in a publication. Read/write.
DisplayStatusBar | True for Microsoft Publisher to show the status bar at the bottom of the Publisher window. Read/write Boolean.
DragAndDropText | True to enable dragging of text. Read/write Boolean.
HyphenationZone | Returns or sets a Variant that represents the maximum amount of space that Microsoft Publisher leaves between the end of the last word in a line and the right margin. Read/write.
MeasurementUnit | Returns or sets a PbUnitType constant representing the standard measurement unit for Microsoft Publisher. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
PathForPictures | Returns a String that represents the default path for picture files. Read.
PathForPublications | Returns a String that represents the default folder for publications. Read.
SaveAutoRecoverInfo | True if Microsoft Publisher automatically saves publications for recovery if the application is unexpectedly shut down. Read/write Boolean.
SaveAutoRecoverInfoInterval | Returns or sets a Long that represents the time interval in minutes for automatically saving a publication for recovery if the application is unexpectedly shut down. Read/write.
SequenceCheck | True to check the sequence of independent characters for Asian text. Read/write Boolean.
ShowBasicColors | Returns or sets a Boolean indicating whether Microsoft Publisher shows basic colors in the color palette; True to show basic colors in the palette. Read/write.
ShowScreenTipsOnObjects | True for Microsoft Publisher to display ScreenTips when the mouse pointer hovers over a text box, shape or other object. Read/write Boolean.
ShowTipPages | True for Microsoft Publisher to display tippages in balloons. Read/write Boolean.
TypeNReplace | True for Microsoft Publisher to replace unreadable Asian character clusters resulting from invalid keyboard sequences. Read/write Boolean.
UseCatalogAtStartup | True for Microsoft Publisher to show the catalog when starting. Read/write Boolean.
UseWizardForBlankPublication | Gets or sets whether to use a wizard for blank publications. Read/Write.


MailMergeDataSource.Type Property (Publisher)

 Copy code hover
[image]

MailMergeDataSource.Type Property (Publisher)
Send feedback

Returns a Long that represents the type of mail merge or catalog merge data source. Read-only.

Syntax

expression .Type

expression A variable that represents a MailMergeDataSource object.


Adjustments Properties (Publisher)

 Copy code hover
[image]

Adjustments Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Item | Returns or sets a Variant indicating the adjustment value specified by the Index argument. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


WrapFormat.Type Property (Publisher)

 Copy code hover
[image]

WrapFormat.Type Property (Publisher)
Send feedback

Specifies how text wraps around the specified shape. Read/write.

Syntax

expression .Type

expression A variable that represents a WrapFormat object.

Remarks

The Type property value can be one of the PbWrapType constants declared in the Microsoft Publisher type library.

Example

The following example adds an oval to the active publication and specifies that the publication text wrap around both the left and right sides of the square that surrounds the oval.

VBA Copy code Copy code
Sub SetTextWrapType()
 Dim shpOval As Shape

 Set shpOval = ActiveDocument.Pages(1).Shapes.AddShape( _
 Type:=msoShapeOval, Left:=36, Top:=36, _
 Width:=100, Height:=35)

 With shpOval.TextWrap
 .Type = pbWrapTypeSquare
 .Side = pbWrapSideBoth
 End With
End Sub


WebNavigationBarHyperlinks Methods (Publisher)

 Copy code hover
[image]

WebNavigationBarHyperlinks Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Add | Adds a new Hyperlink object to the specified WebNavigationBarHyperlinks collection and returns the new Hyperlink object. .
Item | Returns an individual object in a specified collection.


ColorScheme.Application Property (Publisher)

 Copy code hover
[image]

ColorScheme.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a ColorScheme object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Cell.BorderRight Property (Publisher)

 Copy code hover
[image]

Cell.BorderRight Property (Publisher)
Send feedback

Returns a CellBorder object that represents the right border for a specified table cell.

Syntax

expression .BorderRight

expression A variable that represents a Cell object.

Return Value

CellBorder

Example

This example creates a checkerboard design using borders and a fill color with an existing table. This assumes the first shape on page two is a table and not another type of shape and that the table has an uneven number of columns.

Copy code Copy code
Sub FillCellsByRow()
 Dim shpTable As Shape
 Dim rowTable As Row
 Dim celTable As Cell
 Dim intCell As Integer

 intCell = 1

 Set shpTable = ActiveDocument.Pages(2).Shapes(1)
 For Each rowTable In shpTable.Table.Rows
 For Each celTable In rowTable.Cells
 With celTable
 With .BorderBottom
 .Weight = 2
 .Color.RGB = RGB(Red:=0, Green:=0, Blue:=0)
 End With
 With .BorderTop
 .Weight = 2
 .Color.RGB = RGB(Red:=0, Green:=0, Blue:=0)
 End With
 With .BorderLeft
 .Weight = 2
 .Color.RGB = RGB(Red:=0, Green:=0, Blue:=0)
 End With
 With .BorderRight
 .Weight = 2
 .Color.RGB = RGB(Red:=0, Green:=0, Blue:=0)
 End With
 End With
 If intCell Mod 2 = 0 Then
 celTable.Fill.ForeColor.RGB = RGB _
 (Red:=180, Green:=180, Blue:=180)
 Else
 celTable.Fill.ForeColor.RGB = RGB _
 (Red:=255, Green:=255, Blue:=255)
 End If
 intCell = intCell + 1
 Next celTable
 Next rowTable

End Sub


Sections Methods (Publisher)

 Copy code hover
[image]

Sections Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Add | Adds a new Section object to the specified Sections collection and returns the new Section object.


Document.AvailableBuildingBlocks Property (Publisher)

 Copy code hover
[image]

Document.AvailableBuildingBlocks Property (Publisher)
Send feedback

Returns the available members of the BuildingBlocks collection of the current document. Read-only.

Syntax

expression .AvailableBuildingBlocks

expression A variable that represents a Document object.

Return Value

BuildingBlocks


Hyperlink.Application Property (Publisher)

 Copy code hover
[image]

Hyperlink.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a Hyperlink object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


OLEFormat.ProgId Property (Publisher)

 Copy code hover
[image]

OLEFormat.ProgId Property (Publisher)
Send feedback

Returns a String that represents the programmatic identifier (ProgID) for the specified OLE object. Read-only.

Syntax

expression .ProgId

expression A variable that represents an OLEFormat object.

Return Value

String

Example

This example loops through all the linked OLE object shapes on the first page of the active document and updates all linked Excel worksheets. This example assumes there is at least one shape on the first page of the active publication.

Copy code Copy code
Sub UpdateLinkedOLEObject()
 Dim shp As Shape
 For Each shp In ActiveDocument.Pages(1).Shapes
 If shp.Type = msoLinkedOLEObject Then
 If shp.OLEFormat.ProgId = "Excel.Sheet" Then
 shp.LinkFormat.Update
 End If
 End If
 Next
End Sub


Shape.InlineAlignment Property (Publisher)

 Copy code hover
[image]

Shape.InlineAlignment Property (Publisher)
Send feedback

Returns or sets a PbInlineAlignment constant that indicates whether an inline shape has left, right, or in-text alignment. Read/write.

Syntax

expression .InlineAlignment

expression A variable that represents a Shape object.

Remarks

The InlineAlignment property value can be one of the PbInlineAlignment constants declared in the Microsoft Publisher type library.

An automation error is returned if the shape is not already inline.

Example

The following example moves the second shape on the second page of the publication into the text flow by using the MoveIntoTextFlow method. The InlineAlignment property is then used to align the shape to the right.

VBA Copy code Copy code
Dim theShape As Shape
Dim theRange As TextRange

Set theRange = ActiveDocument.Pages(2).Shapes(1).TextFrame.TextRange
Set theShape = ActiveDocument.Pages(2).Shapes(2)

If Not theShape.IsInline = msoTrue Then
 theShape.MoveIntoTextFlow Range:=theRange
 theShape.InlineAlignment = pbInlineAlignmentRight
End If


MailMergeFilters.Application Property (Publisher)

 Copy code hover
[image]

MailMergeFilters.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a MailMergeFilters object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


MailMergeMappedDataField.Name Property (Publisher)

 Copy code hover
[image]

MailMergeMappedDataField.Name Property (Publisher)
Send feedback

Returns a String value indicating the name of the specified object. Read-only.

Syntax

expression .Name

expression A variable that represents a MailMergeMappedDataField object.

Remarks

You can use an object's name in conjunction with the Item method or Item property to return a reference to the object if the Item method or property for the collection that contains the object takes a Variant argument. For example, if the value of the Name property for a shape is Rectangle 2, then .Shapes("Rectangle 2") will return a reference to that shape.

The Name property is the default property for the BorderArt, BorderArtFormat, and Label objects.


Application.Quit Method (Publisher)

 Copy code hover
[image]

Application.Quit Method (Publisher)
See also Send feedback

Quits Microsoft Publisher. This is equivalent to clicking Exit on the File menu.

Syntax

expression .Quit

expression A variable that represents an Application object.

Remarks

To avoid losing unsaved changes, use either the Save or SaveAs method to save any open publication before calling the Quit method.

Example

This example saves the open publication if there is one and then closes Publisher.

Copy code Copy code
If Not (ActiveDocument Is Nothing)
 ActiveDocument.Save
End If
Application.Quit

See also

Concepts

Application Object

Other resources

Application Object Members


ShapeRange.Reflection Property (Publisher)

 Copy code hover
[image]

ShapeRange.Reflection Property (Publisher)
See also Send feedback

Returns a ReflectionFormat object that represents the reflection formatting for a range of shapes. Read-only.

Version Information

Version Added: Publisher 2013

Syntax

expression .Reflection

expression A variable that represents a ShapeRange object.

Return value

REFLECTIONFORMAT

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ParagraphFormat.Alignment Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.Alignment Property (Publisher)
Send feedback

Returns or sets a PbParagraphAlignmentType constant that represents the alignment for the specified paragraphs. Read/write.

Syntax

expression .Alignment

expression A variable that represents a ParagraphFormat object.

Remarks

The Alignment property value can be one of the PbParagraphAlignmentType constants declared in the Microsoft Publisher type library.

Example

This example adds a new text box to the first page of the active publication, and then add text and sets the paragraph alignment and font formatting.

VBA Copy code Copy code
Sub NewTextFrame()
 Dim shpTextBox As Shape
 Set shpTextBox = ActiveDocument.Pages(1).Shapes _
 .AddTextbox(Orientation:=pbTextOrientationHorizontal, _
 Left:=72, Top:=72, Width:=468, Height:=72)
 With shpTextBox.TextFrame.TextRange
 .ParagraphFormat.Alignment = pbParagraphAlignmentCenter
 .Text = "Hello World"
 With .Font
 .Name = "Snap ITC"
 .Size = 30
 .Bold = msoTrue
 End With
 End With
End Sub


PrintableRect.Width Property (Publisher)

 Copy code hover
[image]

PrintableRect.Width Property (Publisher)
Send feedback

Returns a Single that represents the printable rectangle. Read-only.

Syntax

expression .Width

expression A variable that represents a PrintableRect object.


ThreeDFormat.Visible Property (Publisher)

 Copy code hover
[image]

ThreeDFormat.Visible Property (Publisher)
Send feedback

Returns or sets an MsoTriState constant indicating whether the specified object or the formatting applied to the specified object is visible. Read/write.

Syntax

expression .Visible

expression A variable that represents a ThreeDFormat object.

Remarks

The Visible property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The specified object or formatting is not visible.
msoTriStateMixed | Return value only. The specified shape range contains both objects with visible formatting and objects with invisible formatting.
msoTriStateToggle | Set value only. Switches the specified object between visible and invisble.
msoTrue | The specified object or formatting is visible.

Example

This example sets the horizontal and vertical offsets for the shadow of shape three on the first page in the active publication. The shadow is offset 5 points to the right of the shape and 3 points above it. If the shape does not already have a shadow, this example adds one to it.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes(3).Shadow
 .Visible = msoTrue
 .OffsetX = 5
 .OffsetY = -3
End With


Attachments.Add Method (Publisher)

 Copy code hover
[image]

Attachments.Add Method (Publisher)
See also Send feedback

Adds an Attachment object to the Attachments collection of a Microsoft Publisher publication.

Version Information

Version Added: Publisher 2007

Syntax

expression .Add(Filename)

expression A variable that represents an Attachments colleciton.

Parameters

Name | Required/Optional | Data Type | Description
Filename | Required | String | File name of the attachment.

Return Value

Attachment

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to add an attachment to the message in an e-mail merge. The code adds an attachment to an e-mail message and then prints the number of current attachments to the message in the Immediate window.

The attachment in this example is an image file at the root of the C drive. Before running the code, replace "C:\image.jpg" with the path to and name of the file on your computer that you want to add as an e-mail attachment.

Before you can create an e-mail merge, you must use the OpenDataSource method of the MailMerge object to connect the active document to a data source. To run the merge, use the Execute method of the MailMerge object. For an example of how to connect to a data source and create an e-mail merge, see the EmailMergeEnvelope object topic.

VBA Copy code Copy code
Public Sub Add_Example()

 Dim pubAttachment As Publisher.Attachment

 Set pubAttachment = ThisDocument.MailMerge.EmailMergeEnvelope.Attachemts.Add("C:\image.jpg")
 Debug.Print ThisDocument.MailMerge.EmailMergeEnvelope.Attachemts.Count

End Sub

See also

Concepts

Attachments Collection

Other resources

Attachments Object Members


Page.IsTwoPageMaster Property (Publisher)

 Copy code hover
[image]

Page.IsTwoPageMaster Property (Publisher)
Send feedback

True if the specified Page object is a two-page master. Read/write Boolean.

Syntax

expression .IsTwoPageMaster

expression A variable that represents an Page object.

Return Value

Boolean

Remarks

This method works for master pages only. Returns a This feature is only for master pages error when attempting to access this property from a publication page object.

Example

The following example adds text to each header of a two-page master page specifying the master page PageNumber and its place in the spread: 1 or 2.

Copy code Copy code
Dim objMasterPage As Page
Dim pageCount As Long
Dim i As Long
pageCount = ActiveDocument.MasterPages.Count
For i = 1 To pageCount
 Set objMasterPage = ActiveDocument.MasterPages(i)
 If objMasterPage.IsTwoPageMaster Then
 objMasterPage.Header.TextRange.Text = "MasterPage " & _
 objMasterPage.PageNumber & ", Page 1 of 2"
 i = i + 1
 Set objMasterPage = ActiveDocument.MasterPages(i)
 objMasterPage.Header.TextRange.Text = "MasterPage " & _
 objMasterPage.PageNumber & ", Page 2 of 2"
 End If
Next i


ScratchArea.Parent Property (Publisher)

 Copy code hover
[image]

ScratchArea.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a ScratchArea object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Shapes.Parent Property (Publisher)

 Copy code hover
[image]

Shapes.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a Shapes object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


CellRange Methods (Publisher)

 Copy code hover
[image]

CellRange Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Item | Returns an individual Cell object in the specified CellRange collection.
Merge | Merges the specified table cells with one another. The result is a single table cell.
Select | Selects the specified object.


TextStyles Members (Publisher)

 Copy code hover
[image]

TextStyles Members (Publisher)
Send feedback

A collection of TextStyle objects that represent both the built-in and user-defined styles in a document.

Methods

Name | Description
Add | Adds a new TextStyle object to the specified TextStyles object and returns the new TextStyle object.
Item | Returns an individual object in a specified collection.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


Shape.BorderArt Property (Publisher)

 Copy code hover
[image]

Shape.BorderArt Property (Publisher)
Send feedback

Returns a BorderArtFormat object that represents the BorderArt type applied to the specified shape. Returns "Permission Denied" if BorderArt has not been applied to the shape. Read-only.

Syntax

expression .BorderArt

expression A variable that represents a Shape object.

Return Value

BorderArtFormat

Remarks

BorderArt are picture borders that can be applied to text boxes, picture frames, or rectangles.

Use the BorderArt property to apply, change, and remove BorderArt from shapes in publications.

Example

The following example tests for the existence of BorderArt on each shape for each page of the active publication. If BorderArt exists, it is deleted.

Copy code Copy code
Sub DeleteBorderArt()

Dim anyPage As Page
Dim anyShape As Shape

For Each anyPage in ActiveDocument.Pages
 For Each anyShape in anyPage.Shapes
 With anyShape.BorderArt
 If .Exists = True Then
 .Delete
 End If
 End With
 Next anyShape
 Next anyPage
End Sub


ParagraphFormat Methods (Publisher)

 Copy code hover
[image]

ParagraphFormat Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Duplicate | Creates a duplicate of the specified ParagraphFormat object and then returns the new ParagraphFormat object.
Reset | Removes manual paragraph or text formatting from the specified object and leaves only the formatting specified by the current text style.
SetLineSpacing | Formats the line spacing of specified paragraphs.
SetListType | Sets the list type of the specified ParagraphFormat object. .


Application.MailMergeAfterMerge Event (Publisher)

 Copy code hover
[image]

Application.MailMergeAfterMerge Event (Publisher)
See also Send feedback

Occurs after all records in a mail merge have merged successfully.

Syntax

expression .MailMergeAfterMerge(Doc)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The mail merge main document.

Remarks

To access the Application object events, declare an Application object variable in the General Declarations section of a code module. Then set the variable equal to the Application object for which you want to access events. For information about using events with the Microsoft Publisher Application object, see Using Events with the Application Object.

Example

This example displays a message stating that all records in the specified document are finished merging.

Copy code Copy code
Private Sub MailMergeApp_MailMergeAfterMerge(ByVal Doc As Document)

 MsgBox "Your mail merge on " & _
 ActiveDocument.Name & " is now finished."

End Sub

For this event to occur, you must place the following line of code in the General Declarations section of your module and run the following initialization routine.

Copy code Copy code
Private WithEvents MailMergeApp As Application

Sub InitializeMailMergeApp()
 Set MailMergeApp = Publisher.Application
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Shape.SetCaption Method

 Copy code hover
[image]

Shape.SetCaption Method
Send feedback

Sets the caption style for the shape.

Syntax

expression .SetCaption(Style)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | CaptionStyle | Specifies the style of the caption.

Return Value

SHAPE

Remarks

This method works only if Shape.Type = pbPicture.


TextRange.Paste Method (Publisher)

 Copy code hover
[image]

TextRange.Paste Method (Publisher)
Send feedback

Pastes the text on the Clipboard into the specified text range, and returns a TextRange object that represents the pasted text.

Syntax

expression .Paste

expression A variable that represents a TextRange object.

Return Value

TextRange

Example

This example deletes the text in shape one on page one in the active publication, places it on the Clipboard, and then pastes it after the first word in shape two on the same page. This example assumes that each shape contains text.

VBA Copy code Copy code
With ActiveDocument.Pages(1)
 .Shapes(1).TextFrame.TextRange.Cut
 .Shapes(2).TextFrame.TextRange. _
 Words(1).Paste
End With


Application.Documents Property (Publisher)

 Copy code hover
[image]

Application.Documents Property (Publisher)
See also Send feedback

Returns a Documents collection that represents all open publications. Read-only.

Syntax

expression .Documents

expression A variable that represents a Application object.

Return Value

Documents

Example

The following example lists all of the open publications.

Copy code Copy code
Dim objDocument As Document
Dim strMsg As String
For Each objDocument In Documents
 strMsg = strMsg & objDocument.Name & vbCrLf
Next objDocument
MsgBox Prompt:=strMsg, Title:="Current Documents Open", Buttons:=vbOKOnly

See also

Concepts

Application Object

Other resources

Application Object Members


ColorSchemes.Application Property (Publisher)

 Copy code hover
[image]

ColorSchemes.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a ColorSchemes object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


LayoutGuides.Application Property (Publisher)

 Copy code hover
[image]

LayoutGuides.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a LayoutGuides object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


GroupShapes Object (Publisher)

 Copy code hover
[image]

GroupShapes Object (Publisher)
Send feedback

Represents the individual shapes within a grouped shape. Each shape is represented by a Shape object. Using the Item method with this object, you can work with single shapes within a group without having to ungroup them.

Example

Use the GroupItems property to return a GroupShapes collection. Use GroupItems(index), where index is the number of the individual shape within the grouped shape, to return a single shape from the GroupShapes collection. The following example adds three triangles to the active document, groups them, sets a color for the entire group, and then changes the color for the third triangle only.

Copy code Copy code
Sub WorkWithGroupShapes()
 With ActiveDocument.Pages.Add(Count:=1, After:=1).Shapes
 .AddShape(msoShapeIsoscelesTriangle, _
 50, 50, 100, 100).Name = "shpOne"
 .AddShape(msoShapeIsoscelesTriangle, _
 200, 50, 100, 100).Name = "shpTwo"
 .AddShape(msoShapeIsoscelesTriangle, _
 350, 50, 100, 100).Name = "shpThree"
 With .Range(Array("shpOne", "shpTwo", "shpThree")).Group
 .Fill.PresetTextured PresetTexture:=msoTextureBlueTissuePaper
 .GroupItems(3).Fill.PresetTextured _
 PresetTexture:=msoTextureGreenMarble
 End With
 End With
End Sub


Application.AfterPrint Event (Publisher)

 Copy code hover
[image]

Application.AfterPrint Event (Publisher)
See also Send feedback

Fires after all variables and fields print.

Version Information

Version Added: Publisher 2007

Syntax

expression .AfterPrint(Doc)

expression An expression that returns an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The current publication.

Remarks

Microsoft Publisher does not return UI control to the user until the event handler is executed. The event is called after all the drawing operations are completed (in other words, after the software's job finishes and the printing hardware takes over).

For more information about using events with the Application object, see Using Events with the Application Object.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to handle the AfterPrint event. It displays a message notifying the user that the document was printed.

VBA Copy code Copy code
Private Sub pubApplication_AfterPrint(ByVal Doc As Document)
 MsgBox "Printing of " & Doc.Name & "is complete."
End Sub

For this event to occur, you must place the following line of code in the General Declarations section of your module.

VBA Copy code Copy code
Private WithEvents pubApplication As Application

Then run the following initialization procedure.

VBA Copy code Copy code
Public Sub Initialize_pubApplication()
 Set pubApplication = Publisher.Application
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


ShapeRange.Height Property (Publisher)

 Copy code hover
[image]

ShapeRange.Height Property (Publisher)
Send feedback

Returns a Variant that represents the height (in points) of a specified range of shapes. Read-only.

Syntax

expression .Height

expression A variable that represents a ShapeRange object.

Remarks

The valid range for the Height property depends on the size of the application workspace and the position of the object within the workspace. For centered objects on non-banner page sizes, the Height property may be 0.0 to 50.0 inches. For centered objects on banner page sizes, the Height property may be 0.0 to 241.0 inches.


BuildingBlock.Description Property (Publisher)

 Copy code hover
[image]

BuildingBlock.Description Property (Publisher)
Send feedback

Gets or sets a string that represents the description of the building block. Read/write.

Syntax

expression .Description

expression A variable that represents a BuildingBlock object.


MailMergeFilters Methods (Publisher)

 Copy code hover
[image]

MailMergeFilters Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
Add | Adds a new filter criterion to the specified MailMergeFilters object.
Delete | Deletes the specified object.
Item | Returns an individual object in a specified collection.


PbWizardNavBarButtonStyle Enumeration (Publisher)

 Copy code hover
[image]

PbWizardNavBarButtonStyle Enumeration (Publisher)
Send feedback

Represents the style of the navigation bar buttons: large, small, or text-only.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbnbButtonStyleLarge | 2 | Large buttons
pbnbButtonStyleSmall | 1 | Small buttons
pbnbButtonStyleText | 3 | Text-only buttons


ReflectionFormat.Type Property (Publisher)

 Copy code hover
[image]

ReflectionFormat.Type Property (Publisher)
See also Send feedback

Returns or sets an MsoReflectionType constant that represents the type and distance from the shape of the reflection. Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .Type

expression A variable that represents a ReflectionFormat object.

Return value

MsoReflectionType

See also

Other resources

ReflectionFormat Object Members
ReflectionFormat Object


Tag.Value Property (Publisher)

 Copy code hover
[image]

Tag.Value Property (Publisher)
Send feedback

Returns or sets a Variant that represents the value of a tag of a shape, page, or publication. Read/write.

Syntax

expression .Value

expression A variable that represents a Tag object.

Example

This example creates a new tag for the active publication and then displays the value of the tag.

VBA Copy code Copy code
Sub CreatePublicationTag()
 With ActiveDocument
 .Tags.Add Name:="ActivePub", Value:="This is the active publication."
 MsgBox .Tags(1).Value
 End With
End Sub


TextFrame.IncludeContinuedOnPage Property (Publisher)

 Copy code hover
[image]

TextFrame.IncludeContinuedOnPage Property (Publisher)
Send feedback

Determines whether the text "Continued on page pagenumber" appears in a text box when Microsoft Publisher links text boxes. Read/write.

Version Information

Version Added: Publisher 2007

Syntax

expression .IncludeContinuedOnPage

expression A variable that represents a TextFrame object.

Return Value

MsoTriState

Remarks

The IncludeContinuedOnPage property corresponds to the Include "Continued on page..." check box in the Publisher user interface. (With the text box selected, on the Format menu, click Text Box, and then click the Text Box tab.)


Shape.ID Property (Publisher)

 Copy code hover
[image]

Shape.ID Property (Publisher)
Send feedback

Returns a Long that represents the type of a shape, range of shapes, or property, type, or value of a wizard. Read-only.

Syntax

expression .ID

expression A variable that represents a Shape object.

Example

This example displays the type for each shape on the first page of the active publication.

Copy code Copy code
Sub ShapeID()
 Dim shp As Shape
 For Each shp In ActiveDocument.Pages(1).Shapes
 MsgBox shp.ID
 Next shp
End Sub


ShapeNodes Properties (Publisher)

 Copy code hover
[image]

ShapeNodes Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


TextRange.Words Method (Publisher)

 Copy code hover
[image]

TextRange.Words Method (Publisher)
Send feedback

Returns a TextRange object that represents the specified subset of text words.

Syntax

expression .Words(Start, Length)

expression A variable that represents a TextRange object.

Parameters

Name | Required/Optional | Data Type | Description
Start | Required | Long | The first word in the returned range.
Length | Optional | Long | The number of words to be returned. Default is 1.

Return Value

TextRange

Remarks

If Length is omitted, the returned range contains one word.

If Start is greater than the number of words in the specified text, the returned range starts with the last word in the specified range.

If Length is greater than the number of words from the specified starting word to the end of the text, the returned range contains all those words.

Example

This example formats as bold the second, third, and fourth words in shape two on page one of the active publication.

Copy code Copy code
Application.ActiveDocument.Pages(1).Shapes(2) _
 .TextFrame.TextRange.Words(Start:=2, Length:=3) _
 .Font.Bold = True


ReaderSpread.Height Property (Publisher)

 Copy code hover
[image]

ReaderSpread.Height Property (Publisher)
Send feedback

Returns a Single that represents the height, in points, of the page. Read-only.

Syntax

expression .Height

expression A variable that represents a ReaderSpread object.

Remarks

The valid range for the Height property depends on the size of the application workspace and the position of the object within the workspace. For centered objects on non-banner page sizes, the Height property may be 0.0 to 50.0 inches. For centered objects on banner page sizes, the Height property may be 0.0 to 241.0 inches.


WebPageOptions.Description Property (Publisher)

 Copy code hover
[image]

WebPageOptions.Description Property (Publisher)
Send feedback

Returns or sets a String that represents the description of a Web page within a Web publication. Read/write.

Syntax

expression .Description

expression A variable that represents a WebPageOptions object.

Example

This example sets the description for page two of the active Web publication.

VBA Copy code Copy code
Dim theWPO As WebPageOptions

Set theWPO = ActiveDocument.Pages(2).WebPageOptions

With theWPO
 .Description = "Company Profile"
End With


RulerGuides.Item Property (Publisher)

 Copy code hover
[image]

RulerGuides.Item Property (Publisher)
Send feedback

Returns an individual object from a specified collection. Read-only.

Syntax

expression .Item(Index)

expression A variable that represents a RulerGuides object.

Parameters

Name | Required/Optional | Data Type | Description
Item | Required | Long | The number of the object to return.

Example

This example sets the position of the first ruler guide to 3 inches from the edge of the publication.

VBA Copy code Copy code
ActiveDocument.Pages(1).RulerGuides _
 .Item(1).Position = InchesToPoints(3)


Application.Build Property (Publisher)

 Copy code hover
[image]

Application.Build Property (Publisher)
See also Send feedback

Returns a Long that represents the Microsoft Publisher build number. Read-only.

Syntax

expression .Build

expression A variable that represents a Application object.

Return Value

Long

Example

This example displays the Publisher build number.

Copy code Copy code
Sub BuildNumber()
 MsgBox Prompt:="The current Microsoft Publisher build number is " & _
 Application.Build, Title:="Microsoft Publisher Build"
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


TextRange.Copy Method (Publisher)

 Copy code hover
[image]

TextRange.Copy Method (Publisher)
Send feedback

Copies the specified object to the Clipboard.

Syntax

expression .Copy

expression A variable that represents a TextRange object.

Return Value

Nothing

Remarks

Use the Paste method to paste the contents of the Clipboard.

The Copy method can be used on Shape objects, but the Paste method cannot.

Example

This example copies shapes one and two on page one of the active publication to the Clipboard and then pastes the copies onto page two.

VBA Copy code Copy code
With ActiveDocument
 .Pages(1).Shapes.Range(Array(1, 2)).Copy
 .Pages(2).Shapes.Paste
End With

This example copies shape one on page one of the active publication to the Clipboard.

Copy code Copy code
ActiveDocument.Pages(1).Shapes(1).Copy

This example copies the text in shape one on page one of the active publication to the Clipboard.

Copy code Copy code
ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange.Copy


TabStops.Item Method (Publisher)

 Copy code hover
[image]

TabStops.Item Method (Publisher)
Send feedback

Returns an individual object in a specified collection.

Syntax

expression .Item(Index)

expression A variable that represents a TabStops object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The number of the object to return.

Return Value

TabStop


Page.IsTrailing Property (Publisher)

 Copy code hover
[image]

Page.IsTrailing Property (Publisher)
Send feedback

True if the specified Page object is a trailing page of a two-page spread. Read-only Boolean.

Syntax

expression .IsTrailing

expression A variable that represents an Page object.

Return Value

Boolean

Example

The following example diplays for each page whether the page is a trailing or leading page in the publication.

Copy code Copy code
Dim objPage As Page
Dim strPageInfo As String
For Each objPage In ActiveDocument.Pages
 strPageInfo = "Page number " & objPage.PageNumber
 If objPage.IsLeading Then
 strPageInfo = strPageInfo & " is a leading page." & Chr(13)
 ElseIf objPage.IsTrailing Then
 strPageInfo = strPageInfo & " is a trailing page." & Chr(13)
 End If
 MsgBox strPageInfo
Next objPage


Window.Hwnd Property (Publisher)

 Copy code hover
[image]

Window.Hwnd Property (Publisher)
Send feedback

Returns a Long indicating the handle to the Microsoft Publisher application window. Read-only.

Syntax

expression .Hwnd

expression A variable that represents a Window object.

Return Value

Long

Example

The following example displays the handle to the Publisher application window.

Copy code Copy code
MsgBox "The handle to the Publisher application window is " & _
 Application.ActiveWindow.Hwnd


BuildingBlock Object (Publisher)

 Copy code hover
[image]

BuildingBlock Object (Publisher)
Send feedback

Represents a single building block. The BuildingBlock object is a member of the BuildingBlocks collection.


ColorCMYK Object (Publisher)

 Copy code hover
[image]

ColorCMYK Object (Publisher)
Send feedback

Represents a cyan-magenta-yellow-black (CMYK) color value.

Example

Use the CMYK property of a ColorFormat object to return a ColorCMYK object. Use the Cyan, Magenta, Yellow, and Black properties of the ColorCMYK object to individually set each of the four colors in the CMYK color value. Use the SetCMYK method on a ColorCMYK object to set all four colors at once.

The following example retrieves the CMYK color value of shape one's fill and changes it to another CMYK color value.

VBA Copy code Copy code
Dim cmykColor As ColorCMYK

 Set cmykColor = ActiveDocument.Pages(1).Shapes(1).Fill.ForeColor.CMYK

 cmykColor.SetCMYK Cyan:=0, Magenta:=255, Yellow:=255, Black:=50


PageSize.LeftMargin Property (Publisher)

 Copy code hover
[image]

PageSize.LeftMargin Property (Publisher)
Send feedback

Specifies the distance between the left edge of the printer sheet and the top edge of the publication page in the blank page size represented by the parent PageSize object. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .LeftMargin

expression A variable that represents a PageSize object.

Return Value

Variant

Remarks

The blank page size represented by the parent PageSize object corresponds to one of the icons displayed under Blank Page Sizes in the Page Setup dialog box in the Microsoft Publisher user interface.


Document.ShapesRemoved Event (Publisher)

 Copy code hover
[image]

Document.ShapesRemoved Event (Publisher)
Send feedback

Occurs when a shape is deleted from a publication.

Syntax

expression .ShapesRemoved

expression A variable that represents a Document object.

Example

This example displays a message whenever a shape is removed from the active publication. For this example to work, you must place this code into the ThisDocument module.

Copy code Copy code
Private Sub Document_ShapesRemoved()
 MsgBox "You just deleted one or more shapes."
End Sub


Printer.PaperWidth Property (Publisher)

 Copy code hover
[image]

Printer.PaperWidth Property (Publisher)
Send feedback

Gets or sets the width of a printed page in points. Read/write.

Version Information

Version Added: Publisher 2007

Syntax

expression .PaperWidth

expression A variable that represents a Printer object.

Return Value

Long


Hyperlinks.Parent Property (Publisher)

 Copy code hover
[image]

Hyperlinks.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a Hyperlinks object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


MailMergeDataSource.Parent Property (Publisher)

 Copy code hover
[image]

MailMergeDataSource.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a MailMergeDataSource object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


WizardProperties.Item Property (Publisher)

 Copy code hover
[image]

WizardProperties.Item Property (Publisher)
Send feedback

Returns an individual object from a specified collection. Read-only.

Syntax

expression .Item(Index)

expression A variable that represents a WizardProperties object.

Parameters

Name | Required/Optional | Data Type | Description
Item | Required | Long | The number of the object to return.


Font.NumberStyle Property (Publisher)

 Copy code hover
[image]

Font.NumberStyle Property (Publisher)
Send feedback

Returns or sets a pbNumberStyles constant that represents the state of the NumberStyles property on the numerical characters in a text range. Read/write.

Version Information

Version Added: Publisher 2010

Syntax

expression . NumberStyles

expression A variable that represents a Font object.

Return Value

pbNumberStyles

Remarks

Note Note

The NumberStyles property has an effect only for OpenType fonts that contain number styles.


SoftEdgeFormat.Type Property (Publisher)

 Copy code hover
[image]

SoftEdgeFormat.Type Property (Publisher)
See also Send feedback

Returns or sets a Single that represents the length of the radius for a soft edge effect. Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .Type

expression A variable that represents a SoftEdgeFormat object.

Return value

MSOSOFTEDGETYPE

See also

Other resources

SoftEdgeFormat Object
SoftEdgeFormat Object Members


Document.ConvertPublicationType Method (Publisher)

 Copy code hover
[image]

Document.ConvertPublicationType Method (Publisher)
Send feedback

Converts the specified publication to the specified publication type.

Syntax

expression .ConvertPublicationType(Value)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Value | Required | PbPublicationType | The type of publication to which you want the publication converted.

Remarks

When a publication is converted, any settings that apply to its previous type remain, but are ignored. For example, converting a print publication to a Web publication results in any advanced print settings being ignored. If the publication is converted back to a print publication, the settings take effect again.

Use the PublicationType property of the Document object to determine the publication type of a publication.

The Value parameter can be one of the following PbPublicationType constants declared in the Microsoft Publisher type library.

pbTypePrint

pbTypeWeb

Example

The following example determines if the active publication is a print publication. If it is, the publication is converted to a Web publication.

VBA Copy code Copy code
Sub ChangePublicationType()
 With ActiveDocument
 If .PublicationType = pbTypePrint Then
 .ConvertPublicationType (pbTypeWeb)
 End If
 End With
End Sub


ObjectVerbs Object (Publisher)

 Copy code hover
[image]

ObjectVerbs Object (Publisher)
Send feedback

Represents the collection of OLE verbs for the specified OLE object. OLE verbs are the operations supported by an OLE object. Commonly used OLE verbs are play and edit.

Example

Use the ObjectVerbs property to return an ObjectVerbs object. The following example displays all the available verbs for the OLE object contained in the first shape on first page in the active publication. For this example to work, the specified shape must contain an OLE object.

Copy code Copy code
Sub GetVerbs()
 Dim intCount As Integer

 With ActiveDocument.Pages(1).Shapes(1).OLEFormat
 For intCount = 1 To .ObjectVerbs.Count
 MsgBox .ObjectVerbs(intCount)
 Next
 End With
End Sub


FillFormat.OneColorGradient Method (Publisher)

 Copy code hover
[image]

FillFormat.OneColorGradient Method (Publisher)
Send feedback

Sets the specified fill to a one-color gradient.

Syntax

expression .OneColorGradient(Style, Variant, Degree)

expression A variable that represents a FillFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | MsoGradientStyle | The gradient style.
Variant | Required | Long | The gradient variant. Can be a value from 1 to 4, corresponding to the four variants on the Gradient tab in the Fill Effects dialog box. If Style is msoGradientFromTitle or msoGradientFromCenter, this argument can be either 1 or 2.
Degree | Required | Single | The gradient degree. Can be a value from 0.0 (dark) to 1.0 (light).

Remarks

The Style parameter can be one of the MsoGradientStyle constants declared in the Microsoft Office type library and shown in the following table.

msoGradientDiagonalDown

msoGradientDiagonalUp

msoGradientFromCenter

msoGradientFromCorner

msoGradientFromTitle

msoGradientHorizontal

msoGradientVertical

Example

This example adds a rectangle with a one-color gradient fill to the active publication.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes _
 .AddShape(Type:=msoShapeRectangle, _
 Left:=90, Top:=90, Width:=90, Height:=80).Fill
 .ForeColor.RGB = RGB(0, 128, 128)
 .OneColorGradient Style:=msoGradientHorizontal, _
 Variant:=1, Degree:=1
End With


WebNavigationBarSets.Parent Property (Publisher)

 Copy code hover
[image]

WebNavigationBarSets.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a WebNavigationBarSets object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


OLEFormat Object (Publisher)

 Copy code hover
[image]

OLEFormat Object (Publisher)
Send feedback

Represents the OLE characteristics, other than linking (see the LinkFormat object), for an OLE object, ActiveX control, or field.

Remarks

Not all types of shapes and fields have OLE capabilities. Use the Type property for the Shape object to determine into which category the specified shape falls.

Use the Activate and DoVerb methods to automate an OLE object.

Example

Use the OLEFormat property for a shape or field to return an OLEFormat object. The following example activates all OLE objects in the active publication.

Copy code Copy code
Sub ActivateOLEObjects()
 Dim shpShape As Shape

 For Each shpShape In ActiveDocument.Pages(1).Shapes
 If shpShape.Type = pbLinkedOLEObject Then
 shpShape.OLEFormat.Activate
 End If
 Next
End Sub


CatalogMergeShapes Properties (Publisher)

 Copy code hover
[image]

CatalogMergeShapes Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
HorizontalRepeat | Returns a Long that represents the number of times the catalog merge area will repeat across the target publication page when the catalog merge is executed. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
VerticalRepeat | Returns a Long that represents the number of times the catalog merge area will repeat down the target publication page when the catalog merge is executed. Read-only.


MailMergeDataSource.FirstRecord Property (Publisher)

 Copy code hover
[image]

MailMergeDataSource.FirstRecord Property (Publisher)
Send feedback

Returns or sets a Long that represents the number of the first record to be merged in a mail merge or catalog merge operation. Read/write.

Syntax

expression .FirstRecord

expression A variable that represents a MailMergeDataSource object.

Return Value

Long

Example

This example sets the active record as the first record to be merged, and then merges three records ending with the record two records forward in the data source. This example assumes that the active publication is a mail merge document.

Copy code Copy code
Sub RecordOne()
 With ActiveDocument.MailMerge
 .DataSource.FirstRecord = .DataSource.ActiveRecord
 .DataSource.LastRecord = .DataSource.ActiveRecord + 2
 .Execute Pause:=True
 End With
End Sub


Table.Parent Property (Publisher)

 Copy code hover
[image]

Table.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. Read-only.

Syntax

expression .Parent

expression A variable that represents a Table object.


PbColorModel Enumeration (Publisher)

 Copy code hover
[image]

PbColorModel Enumeration (Publisher)
Send feedback

Represents the color model of the picture.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbColorModelCMYK | 2 | CMYK
pbColorModelGreyScale | 3 | GreyScale
pbColorModelRGB | 1 | RGB
pbColorModelUnknown | 4 | Unknown


Application.InstalledPrinters Property (Publisher)

 Copy code hover
[image]

Application.InstalledPrinters Property (Publisher)
See also Send feedback

Returns an InstalledPrinters collection that represents the names of all the printers installed on the computer and to which Microsoft Publisher can print the publication. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .InstalledPrinters

expression A variable that represents an Application object.

Return Value

InstalledPrinters

See also

Concepts

Application Object

Other resources

Application Object Members


ShadowFormat.OffsetY Property (Publisher)

 Copy code hover
[image]

ShadowFormat.OffsetY Property (Publisher)
Send feedback

Returns or sets a Variant value indicating the horizontal offset of the shadow from the specified shape. A positive value offsets the shadow to the right of the shape; a negative value offsets it to the left. Read/write.

Syntax

expression .OffsetY

expression A variable that represents an ShadowFormat object.

Return Value

Variant

Remarks

Numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

If you want to nudge a shadow horizontally or vertically from its current position without having to specify an absolute position, use the IncrementOffsetX method or the IncrementOffsetY method.

Example

This example sets the horizontal and vertical offsets of the shadow for shape three on page one of the active publication. The shadow is offset 5 points to the right of the shape and 3 points above it. If the shape doesn't already have a shadow, this example adds one to it.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes(3).Shadow
 .Visible = True
 .OffsetX = 5
 .OffsetY = -3
End With


PageSetup.HorizontalGap Property (Publisher)

 Copy code hover
[image]

PageSetup.HorizontalGap Property (Publisher)
Send feedback

Returns a Variant that represents the distance between the right edge of one publication page and left edge of the next publication page in the same row when multiple pages are printed on one sheet of printer paper. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .HorizontalGap

expression A variable that represents a PageSetup object.

Return Value

Variant

Remarks

Numeric values are evaluated as points; string values can be in any unit supported by Microsoft Publisher (for example, "2.5 in"). The valid range of possible values is from zero to the difference between the sheet width and the page width.

This property applies only to publications where multiple pages will be printed on each printer sheet. Using this property for any other publication raises an error.


Shape.GetLeft Method (Publisher)

 Copy code hover
[image]

Shape.GetLeft Method (Publisher)
Send feedback

Returns the distance of the shape's or shape range's left edge from the left edge of the leftmost page in the current view as a Single in the specified units.

Syntax

expression .GetLeft(Unit)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Required | PbUnitType | The units in which to return the distance.

Return Value

Single

Remarks

The Unit parameter can be one of the PbUnitType constants declared in the Microsoft Publisher type library.

Use the GetTop method to return the distance of a shape's or shape range's top edge from the top edge of the leftmost page in the current view.

Example

The following example displays the distances from the left and top edges of the leftmost page to the left and top edges of shape range consisting of all the shapes on the first page. The distances are expressed in inches (to the nearest hundredth).

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes.Range
 MsgBox "Distance from left: " _
 & Format(.GetLeft(Unit:=pbUnitInch), "0.00") _
 & " in" & vbCr _
 & "Distance from top: " _
 & Format(.GetTop(Unit:=pbUnitInch), "0.00") _
 & " in"
End With


PbBuildingBlockGallery Enumeration (Publisher)

 Copy code hover
[image]

PbBuildingBlockGallery Enumeration (Publisher)
Send feedback

Constants that represent galleries of building blocks.

Version Information

Version Added: Publisher 2010

Name | Value | Description
pbBBGalAccents | 1 | Borders & Accents gallery
pbBBGalAdvertisements | 0 | Advertisements gallery
pbBBGalBusinessInfo | 3 | Business Information gallery
pbBBGalCalendars | 2 | Calendars gallery
pbBBGalNone | -1 (&HFFFFFFFF) | No gallery
pbBBGalPageParts | 4 | Page Parts gallery


ShapeRange.Line Property (Publisher)

 Copy code hover
[image]

ShapeRange.Line Property (Publisher)
Send feedback

Returns a LineFormat object that contains line formatting properties for the specified shape. (For a line, the LineFormat object represents the line itself; for a shape with a border, the LineFormat object represents the border.).

Syntax

expression .Line

expression A variable that represents a ShapeRange object.

Example

This example adds a blue dashed line to the active publication.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes _
 .AddLine(BeginX:=10, BeginY:=10, _
 EndX:=250, EndY:=250).Line
 .DashStyle = msoLineDashDotDot
 .ForeColor.RGB = RGB(50, 0, 128)
End With

This example adds a cross to the first page and then sets its border to be 8 points thick and red.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes _
 .AddShape(Type:=msoShapeCross, _
 Left:=10, Top:=10, Width:=50, Height:=70).Line
 .Weight = 8
 .ForeColor.RGB = RGB(255, 0, 0)
End With


Document.Find Property (Publisher)

 Copy code hover
[image]

Document.Find Property (Publisher)
Send feedback

Syntax

expression .Find

expression A variable that represents a Document object.

Example

As it applies to the Document object.

The following example sets an object variable to the FindReplace object of the active document. A search operation is executed that applies bold formatting to every occurrence of the word "important".

VBA Copy code Copy code
Dim objFind as FindReplace
Dim fFound as Boolean

Set objFind = ActiveDocument.Find
fFound = True

With objFind
 .Clear
 .FindText = "important"
 Do While fFound = True
 fFound = .Execute
 If Not .FoundTextRange Is Nothing Then
 .FoundTextRange.Font.Bold = True
 End If
 Loop
End With

As it applies to the TextRange object.

The following example sets an object variable to the FindReplace object of the text range of the first shape in the active document. A search operation is executed that applies bold formatting to every occurrence of the word "urgent" in the text range.

VBA Copy code Copy code
Dim objFind as FindReplace
Dim fFound as Boolean

Set objFind = ActiveDocument.Pages(1) _
 .Shapes(1).TextFrame.TextRange.Find
fFound = True

With objFind
 .Clear
 .FindText = "urgent"
 Do While fFound = True
 fFound = .Execute
 If Not .FoundTextRange Is Nothing Then
 .FoundTextRange.Font.Bold = True
 End If
 Loop
End With


PbFontScriptType Enumeration (Publisher)

 Copy code hover
[image]

PbFontScriptType Enumeration (Publisher)
Send feedback

Represents the font script for a text range.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbFontScriptArabic | 7 | Arabic
pbFontScriptArmenian | 5 | Armenian
pbFontScriptAsciiLatin | 1 | Ascii Latin
pbFontScriptAsciiSym | 43 | Ascii Sym
pbFontScriptBengali | 9 | Bengali
pbFontScriptBopomofo | 23 | Bopomofo
pbFontScriptBraille | 41 | Braille
pbFontScriptCanadianAbor | 36 | Canadian Abor
pbFontScriptCherokee | 35 | Cherokee
pbFontScriptCurrency | 42 | Currency
pbFontScriptCyrillic | 4 | Cyrillic
pbFontScriptDefault | 0 | Default
pbFontScriptDevanagari | 8 | Devanagari
pbFontScriptEthiopic | 34 | Ethiopic
pbFontScriptEUDC | 26 | EUDC
pbFontScriptGeorgian | 20 | Georgian
pbFontScriptGreek | 3 | Greek
pbFontScriptGujarati | 11 | Gujarati
pbFontScriptGurmukhi | 10 | Gurmukhi
pbFontScriptHalfWidthKana | 25 | Half WidthKana
pbFontScriptHan | 24 | Han
pbFontScriptHangul | 21 | Hangul
pbFontScriptHanSurrogate | 28 | Han Surrogate
pbFontScriptHebrew | 6 | Hebrew
pbFontScriptKana | 22 | Kana
pbFontScriptKannada | 15 | Kannada
pbFontScriptKhmer | 39 | Khmer
pbFontScriptLao | 18 | Lao
pbFontScriptLatin | 2 | Latin
pbFontScriptMalayalam | 16 | Malayalam
pbFontScriptMixed | -2 | Mixed
pbFontScriptMongolian | 40 | Mongolian
pbFontScriptMyanmar | 32 | Myanmar
pbFontScriptNonHanSurrogate | 29 | Non-Han Surrogate
pbFontScriptOgham | 37 | Ogham
pbFontScriptOriya | 12 | Oriya
pbFontScriptRunic | 38 | Runic
pbFontScriptSinhala | 33 | Sinhala
pbFontScriptSyriac | 30 | Syriac
pbFontScriptTamil | 13 | Tamil
pbFontScriptTelugu | 14 | Telugu
pbFontScriptThaana | 31 | Thaana
pbFontScriptThai | 17 | Thai
pbFontScriptTibetan | 19 | Tibetan
pbFontScriptYi | 27 | Yi


Story.Table Property (Publisher)

 Copy code hover
[image]

Story.Table Property (Publisher)
Send feedback

Returns a Table object that represents a table in Microsoft Publisher.

Syntax

expression .Table

expression A variable that represents a Story object.

Example

The following example adds a 5x5 table on the first page of the active publication, and then selects the first column of the new table.

VBA Copy code Copy code
Sub NewTable()
 With ActiveDocument.Pages(1).Shapes.AddTable(NumRows:=5, _
 NumColumns:=5, Left:=72, Top:=300, Width:=400, Height:=100)
 .Table.Columns(3).Cells(3).Fill.ForeColor.RGB = RGB _
 (Red:=255, Green:=0, Blue:=0)
 End With
End Sub

The following example selects the specified table in the active publication. This example assumes that there is at least one shape on the first page of the active publication.

VBA Copy code Copy code
Sub SelectTable()
 With ActiveDocument.Pages(1).Shapes(1)
 If .Type = pbTable Then
 .Table.Rows(3).Cells(3).Fill.ForeColor _
 .RGB = RGB(Red:=150, Green:=150, Blue:=150)
 End If
 End With
End Sub


ReflectionFormat.Offset Property (Publisher)

 Copy code hover
[image]

ReflectionFormat.Offset Property (Publisher)
See also Send feedback

Returns or sets the amount of separation, in points, of the reflected image from the shape. Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .Offset

expression A variable that represents a ReflectionFormat object.

Return value

Single

See also

Other resources

ReflectionFormat Object Members
ReflectionFormat Object


PbUnitType Enumeration (Publisher)

 Copy code hover
[image]

PbUnitType Enumeration (Publisher)
Send feedback

Represents the standard measurement unit for Microsoft Publisher.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbUnitCM | 1 | Sets the unit of measurement to centimeters.
pbUnitEmu | 4 | Sets the unit of measurement to Emu.
pbUnitFeet | 6 | Sets the unit of measurement to feet.
pbUnitHa | 9 | Sets the unit of measurement to Ha.
pbUnitInch | 0 | Sets the unit of measurement to inches.
pbUnitKyu | 8 | Sets the unit of measurement to Kyu.
pbUnitMeter | 7 | Sets the unit of measurement to meters.
pbUnitPica | 2 | Sets the unit of measurement to picas.
pbUnitPixel | 10 | Sets the unit of measurement to pixels.
pbUnitPoint | 3 | Sets the unit of measurement to points.
pbUnitTwip | 5 | Sets the unit of measurement to twip.


CellBorder Properties (Publisher)

 Copy code hover
[image]

CellBorder Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Color | Returns a ColorFormat object representing the color information for the specified object.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Weight | Returns or sets a Variant indicating the thickness of the specified line or cell border.


FindReplace.MatchDiacritics Property (Publisher)

 Copy code hover
[image]

FindReplace.MatchDiacritics Property (Publisher)
Send feedback

Sets or returns a Boolean representing whether or not a search operation will match diacritics. Read/write.

Syntax

expression .MatchDiacritics

expression A variable that represents a FindReplace object.

Return Value

Boolean

Remarks

This property may not be available depending on the languages enabled on your operating system. The default value is False.

Returns Access denied if a proper language, such as Arabic, is not enabled.

Example

This example finds the first occurrence of the word "gegenüber" in a German document.

Copy code Copy code
Dim objDocument As Document

Set objDocument = ActiveDocument
With objDocument.Find
 .Clear
 .FindText = "gegenüber"
 .MatchDiacritics = True
 .Execute
End With


ShadowFormat.Blur Property (Publisher)

 Copy code hover
[image]

ShadowFormat.Blur Property (Publisher)
See also Send feedback

Returns or sets a Single that represents the blur level for a shadow format. Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .Blur

expression A variable that represents a ShadowFormat object.

Return value

Single

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


PbWizardGroup Enumeration (Publisher)

 Copy code hover
[image]

PbWizardGroup Enumeration (Publisher)
Send feedback

The type of Design Gallery object to add to the publication.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbWizardGroupAccentBox | 151 | Accent Box
pbWizardGroupAccessoryBar | 154 | Accessory Bar
pbWizardGroupAdvertisements | 68 | Advertisements
pbWizardGroupAttentionGetter | 61 | Attention Getter
pbWizardGroupBarbells | 52 | Barbells
pbWizardGroupBorders | 155 | Borders
pbWizardGroupBoxes | 50 | Boxes
pbWizardGroupCalendars | 77 | Calendars
pbWizardGroupCheckerboards | 53 | Checkerboards
pbWizardGroupCoupon | 60 | Coupon
pbWizardGroupDots | 49 | Dots
pbWizardGroupEastAsiaZipCode | 181 | EastAsia ZipCode
pbWizardGroupJapaneseAccentBox | 168 | Japanese Accent Box
pbWizardGroupJapaneseAccessoryBar | 171 | Japanese Accessory Bar
pbWizardGroupJapaneseAttentionGetters | 97 | Japanese Attention Getters
pbWizardGroupJapaneseBorders | 172 | Japanese Borders
pbWizardGroupJapaneseCalendar | 83 | Japanese Calendar
pbWizardGroupJapaneseCoupons | 99 | Japanese Coupons
pbWizardGroupJapaneseLinearAccent | 170 | Japanese Linear Accent
pbWizardGroupJapaneseMarquees | 167 | Japanese Marquees
pbWizardGroupJapaneseMastheads | 141 | Japanese Mastheads
pbWizardGroupJapanesePullQuotes | 144 | Japanese Pull Quotes
pbWizardGroupJapaneseReplyForms | 137 | Japanese Reply Forms
pbWizardGroupJapaneseSidebars | 143 | Japanese Sidebars
pbWizardGroupJapaneseTableOfContents | 142 | Japanese Table Of Contents
pbWizardGroupJapaneseWebButtonEmail | 182 | Japanese Web Button E-mail
pbWizardGroupJapaneseWebButtonHome | 183 | Japanese Web Button Home
pbWizardGroupJapaneseWebButtonLink | 184 | Japanese Web Button Link
pbWizardGroupJapaneseWebMastheads | 138 | Japanese Web Mastheads
pbWizardGroupJapaneseWebNavigationBars | 148 | Japanese Web Navigation Bars
pbWizardGroupJapaneseWebPullQuotes | 139 | Japanese Web Pull Quotes
pbWizardGroupJapaneseWebSidebars | 140 | Japanese Web Sidebars
pbWizardGroupLinearAccent | 153 | Linear Accent
pbWizardGroupLogo | 4 | Logo
pbWizardGroupMarquee | 150 | Marquee
pbWizardGroupMastheads | 105 | Mastheads
pbWizardGroupPhoneTearoff | 66 | Phone Tearoff
pbWizardGroupPictureCaptions | 109 | Picture Captions
pbWizardGroupPullQuotes | 108 | Pull Quotes
pbWizardGroupPunctuation | 152 | Punctuation
pbWizardGroupReplyForms | 79 | Reply Forms
pbWizardGroupSidebars | 107 | Sidebars
pbWizardGroupTableOfContents | 106 | Table of Contents
pbWizardGroupWebButtonsEmail | 133 | Web Buttons E-mail
pbWizardGroupWebButtonsHome | 134 | Web Buttons Home
pbWizardGroupWebButtonsLink | 136 | Web Buttons Link
pbWizardGroupWebCalendars | 35 | Web Calendars
pbWizardGroupWebMastheads | 102 | Web Mastheads
pbWizardGroupWebNavigationBars | 75 | Web Navigation Bars
pbWizardGroupWebSidebars | 104 | Group Web Sidebars
pbWizardGroupWellPullQuotes | 103 | Group Well Pull Quotes


FillFormat.Solid Method (Publisher)

 Copy code hover
[image]

FillFormat.Solid Method (Publisher)
Send feedback

Sets the specified fill to a uniform color. Use this method to convert a gradient, textured, patterned, or background fill back to a solid fill.

Syntax

expression .Solid

expression A variable that represents a FillFormat object.

Example

This example converts all fills on the first page of the active publication to uniform red fills.

Copy code Copy code
Dim shpLoop As Shape

For Each shpLoop In ActiveDocument.Pages(1).Shapes
 With shpLoop.Fill
 .Solid
 .ForeColor.RGB = RGB(255, 0, 0)
 End With
Next shpLoop


WebOptions.AlwaysSaveInDefaultEncoding Property (Publisher)

 Copy code hover
[image]

WebOptions.AlwaysSaveInDefaultEncoding Property (Publisher)
Send feedback

Returns or sets a Boolean value that specifies whether Web pages within a Web publication should always be saved using default encoding. If True, Web pages within a publication will always be saved using the default encoding of the client computer. If False, Web pages will not be saved using default encoding. The default value is False. Read/write.

Syntax

expression .AlwaysSaveInDefaultEncoding

expression A variable that represents a WebOptions object.

Return Value

Boolean

Remarks

If the AlwaysSaveInDefaultEncoding property is set to True on a given WebOptions object, any subsequent attempts to set the Encoding property on that object will be ignored.

Example

The following example tests whether the Web publication is currently set to be saved using default encoding. If so, the AlwaysSaveInDefaultEncoding property is set to False, and the Encoding property is used to set the encoding to Unicode (UTF-8).

Copy code Copy code
Dim theWO As WebOptions

Set theWO = Application.WebOptions

With theWO
 If .AlwaysSaveInDefaultEncoding = True Then
 .AlwaysSaveInDefaultEncoding = False
 .Encoding = msoEncodingUTF8
 End If
End With


PbTabAlignmentType Enumeration (Publisher)

 Copy code hover
[image]

PbTabAlignmentType Enumeration (Publisher)
Send feedback

Represents the alignment for the specified tab stop.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbTabAlignmentCenter | 1 | Centeral tab alignment
pbTabAlignmentDecimal | 3 | Decimal tab alignment
pbTabAlignmentLeading | 0 | Leading tab alignment
pbTabAlignmentTrailing | 2 | Trailing tab alignment


PbNumberStyles EnumerationType (Publisher)

 Copy code hover
[image]

PbNumberStyles EnumerationType (Publisher)
Send feedback

Constants passed to and returned by the Font.NumberStyle property, specifying the state of the NumberStyle property on the numerical characters in a text range.

Version Information

Version Added: Publisher 2010

Name | Value | Description
pbNumberStyleDefault | 0 | Default number style
pbNumberStyleMixed | -1 | Mixed number styles
pbNumberStyleProportionalLining | 1 | Full-height numbers spaced proportionally
pbNumberStyleProportionalOldstyle | 3 | Numbers that read well with text
pbNumberStyleTabularLining | 2 | Full-height numbers spaced equally
pbNumberStyleTabularOldstyle | 4 | Numbers that read well and are spaced equally


PictureFormat.OriginalHasAlphaChannel Property (Publisher)

 Copy code hover
[image]

PictureFormat.OriginalHasAlphaChannel Property (Publisher)
Send feedback

Returns an MsoTriState constant depending on whether the original, linked picture contains an alpha channel. Read-only.

Syntax

expression .OriginalHasAlphaChannel

expression A variable that represents an PictureFormat object.

Return Value

MsoTriState

Remarks

This property only applies to linked pictures. Returns "Permission Denied" for shapes representing embedded or pasted pictures.

Use either of the following properties to determine whether a shape represents a linked picture:

  • The Type property of the Shape object

  • The IsLinked property of the PictureFormat object

An alpha channel is a special 8-bit channel used by some image processing software to contain additional data, such as masking information or transparency information.

The OriginalHasAlphaChannel property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The original, linked picture does not contain an alpha channel.
msoTriStateMixed | Indicates a combination of msoTrue and msoFalse for the specified shape range.
msoTrue | The original, linked picture contains an alpha channel.

Example

The following example returns whether the first shape on the first page of the active publication contains an alpha channel. If the picture is linked, and the original picture contains an alpha channel, that is also returned. This example assumes the shape is a picture.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes(1).PictureFormat
 If .HasAlphaChannel = msoTrue Then
 Debug.Print .Filename
 Debug.Print "This picture contains an alpha channel."

 If .IsLinked = msoTrue Then
 If .OriginalHasAlphaChannel = msoTrue Then
 Debug.Print "The linked picture " & _
 "also contains an alpha channel."
 End If
 End If
 End If
End With


PhoneticGuide.BaseText Property (Publisher)

 Copy code hover
[image]

PhoneticGuide.BaseText Property (Publisher)
Send feedback

Returns a String that represents the text to which the specified phonetic text applies. Read-only.

Syntax

expression .BaseText

expression A variable that represents a PhoneticGuide object.

Return Value

String

Example

This example adds phonetic text to the selection and displays the text to which the phonetic text applies, which is the originally-selected text. This example assumes text is selected. If no text is selected, the message box will be blank.

Copy code Copy code
Sub AddPhoneticText()
 With Selection.TextRange.Fields.AddPhoneticGuide _
 (Range:=Selection.TextRange, Text:="tray sheek")
 MsgBox "The base text is " & .PhoneticGuide.BaseText
 End With
End Sub


InlineShapes.Parent Property (Publisher)

 Copy code hover
[image]

InlineShapes.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents an InlineShapes object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Options.PathForPictures Property (Publisher)

 Copy code hover
[image]

Options.PathForPictures Property (Publisher)
Send feedback

Returns a String that represents the default path for picture files. Read.

Syntax

expression .PathForPictures

expression A variable that represents a Options object.

Return Value

String

Example

This example places the default path for picture files in a string and then uses the path string to add the specified file to the active publication. (Note that Filename must be replaced with a valid file name for this example to work.)

VBA Copy code Copy code
Sub InsertNewPicture()
 Dim strPicPath As String

 strPicPath = Options.PathForPictures

 ActiveDocument.Pages(1).Shapes.AddPicture FileName:=strPicPath _
 & "Filename", LinktoFile:=msoFalse, _
 SaveWithDocument:=msoTrue, Left:=50, Top:=50, Height:=200

End Sub


MailMergeFilterCriterion.Index Property (Publisher)

 Copy code hover
[image]

MailMergeFilterCriterion.Index Property (Publisher)
Send feedback

Returns a Long that represents the position of a particular item in a specified collection. .

Syntax

expression .Index

expression A variable that represents a MailMergeFilterCriterion object.

Example

The following example loops through the MailMergeDataFields collection and displays the Index and Name properties for each field.

Copy code Copy code
Dim mmfLoop As MailMergeDataField

With ActiveDocument.MailMerge.DataSource
 If .DataFields.Count > 0 Then
 For Each mmfLoop In .DataFields
 Debug.Print "Field " & mmfLoop.Name _
 & " / Index " & mmfLoop.Index
 Next mmfLoop
 Else
 Debug.Print "No fields to report."
 End If
End With

The following example loops through the Plates collection and displays the Index and Name properties for each plate.

VBA Copy code Copy code
Dim plaLoop As Plate

If ActiveDocument.Plates.Count > 0 Then
 For Each plaLoop In ActiveDocument.Plates
 Debug.Print "Plate " & plaLoop.Name _
 & " / Index " & plaLoop.Index
 Next plaLoop
Else
 Debug.Print "No plates to report."
End If


MailMergeMappedDataFields Properties (Publisher)

 Copy code hover
[image]

MailMergeMappedDataFields Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


CatalogMergeShapes.Range Method (Publisher)

 Copy code hover
[image]

CatalogMergeShapes.Range Method (Publisher)
Send feedback

Returns a ShapeRange object that represents a subset of the shapes in a Shapes collection.

Syntax

expression .Range(Index)

expression A variable that represents a CatalogMergeShapes object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual shapes that are to be included in the range. Can be an integer that specifies the index number of the shape, a string that specifies the name of the shape, or an array that contains either integers or strings. If Index is omitted, the Range method returns all the objects in the specified collection.

Return Value

ShapeRange

Example

To specify an array of integers or strings for Index, you can use the Array function. For example, the following instruction returns two shapes specified by name.

VBA Copy code Copy code
Dim arrShapes As Variant
Dim shpRange As ShapeRange

Set arrShapes = Array("Oval 4", "Rectangle 5")
Set shpRange = ActiveDocument.Pages(1) _
 .Shapes.Range(arrShapes)

This example sets the fill pattern for shapes one and three on the active publication.

Copy code Copy code
ActiveDocument.Pages(1).Shapes.Range(Array(1, 3)).Fill _
 .Patterned msoPatternHorizontalBrick
VBA Copy code Copy code

This example sets the fill pattern for the shapes named "Oval 4" and "Rectangle 5" on the first page.

Copy code Copy code
Dim arrShapes As Variant
Dim shpRange As ShapeRange

arrShapes = Array("Oval 4", "Rectangle 5")

Set shpRange = ActiveDocument.Pages(1).Shapes.Range(arrShapes)

shpRange.Fill.Patterned msoPatternHorizontalBrick

This example sets the fill pattern for all shapes on the first page.

Copy code Copy code
ActiveDocument.Pages(1).Shapes _
 .Range.Fill.Patterned msoPatternHorizontalBrick

This example sets the fill pattern for shape one on the first page.

Copy code Copy code
Dim shpRange As ShapeRange

Set shpRange = ActiveDocument.Pages(1).Shapes.Range(1)

shpRange.Fill.Patterned msoPatternHorizontalBrick

This example creates an array that contains all the AutoShapes on the first page, uses that array to define a shape range, and then distributes all the shapes in that range horizontally.

Copy code Copy code
Dim numShapes As Long
Dim numAutoShapes As Long
Dim autoShpArray As Variant
Dim intLoop As Integer
Dim shpRange As ShapeRange

With ActiveDocument.Pages(1).Shapes

 numShapes = .Count
 If numShapes > 1 Then

 numAutoShapes = 0
 ReDim autoShpArray(1 To numShapes)

 For intLoop = 1 To numShapes
 If .Item(intLoop).Type = msoAutoShape Then
 numAutoShapes = numAutoShapes + 1
 autoShpArray(numAutoShapes) = .Item(intLoop).Name
 End If
 Next

 If numAutoShapes > 1 Then
 ReDim Preserve autoShpArray(1 To numAutoShapes)
 Set shpRange = .Range(autoShpArray)
 shpRange.Distribute _
 DistributeCmd:=msoDistributeHorizontally, _
 RelativeTo:=False
 End If

 End If

End With


Shape.GetHeight Method (Publisher)

 Copy code hover
[image]

Shape.GetHeight Method (Publisher)
Send feedback

Returns the height of the shape or shape range as a Single in the specified units.

Syntax

expression .GetHeight(Unit)

expression A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Required | PbUnitType | The units in which to return the height.

Return Value

Single

Remarks

The Unit parameter can be one of the PbUnitType constants declared in the Microsoft Publisher type library.

Use the GetWidth method to return the width of a shape or shape range.

Example

The following example displays the height and width in inches (to the nearest hundredth) of the shape range consisting of all the shapes on the first page of the active publication.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes.Range
 MsgBox "Height of all shapes: " _
 & Format(.GetHeight(Unit:=pbUnitInch), "0.00") _
 & " in" & vbCr _
 & "Width of all shapes: " _
 & Format(.GetWidth(Unit:=pbUnitInch), "0.00") _
 & " in"
End With


SoftEdgeFormat.Visible Property (Publisher)

 Copy code hover
[image]

SoftEdgeFormat.Visible Property (Publisher)
See also Send feedback

True if the specified object, or the formatting applied to it, is visible. Read/write MsoTriState.

Version Information

Version Added: Publisher 2013

Syntax

expression .Visible

expression A variable that represents a SoftEdgeFormat object.

Return value

MSOTRISTATE

See also

Other resources

SoftEdgeFormat Object
SoftEdgeFormat Object Members


PbFileFormat Enumeration (Publisher)

 Copy code hover
[image]

PbFileFormat Enumeration (Publisher)
Send feedback

Constants that indicate the file format of the specified document.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbFileHTMLFiltered | 7 | The file was saved in HTML Filtered format.
pbFilePlainText | 8 | The file was saved in plain text format.
pbFilePublication | 1 | The file was saved with the current version of Microsoft Publisher.
pbFilePublisher2000 | 3 | The file was saved in a Publisher 2000 file format.
pbFilePublisher98 | 2 | The file was saved in a Publisher 98 file format.
pbFileRTF | 6 | The file was saved in Rich Text Format.
pbFileUnicodeText | 9 | The file was saved in Unicode Text Format.
pbFileWebArchive | 5 | The file was saved in the MHTML format that allows users to save a Web page and all its related files as a single file.


WebOptionButton Properties (Publisher)

 Copy code hover
[image]

WebOptionButton Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
ReturnDataLabel | Returns or sets a String that represents the text used by the Web page to label the specified Web object when the page is submitted. Read/write.
Selected | Specifies whether a Web check box or option button is selected. Read/write.
Value | Returns or sets a String that represents the value of a Web check box or option button. Read/write.


Font.Reflection Property (Publisher)

 Copy code hover
[image]

Font.Reflection Property (Publisher)
See also Send feedback

Returns a ReflectionFormat object that represents the reflection formatting for a shape. Read-only.

Version Information

Version Added: Publisher 2013

Syntax

expression .Reflection

expression A variable that represents a Font object.

Return value

REFLECTIONFORMAT

See also

Concepts

Font Object

Other resources

Font Object Members


Shapes.AddEmptyPictureFrame Method (Publisher)

 Copy code hover
[image]

Shapes.AddEmptyPictureFrame Method (Publisher)
Send feedback

Returns a Shape object that represents an empty picture frame inserted at the specified coordinates.

Syntax

expression .AddEmptyPictureFrame(Left, Top, Width, Height)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
Left | Required | Variant | The position of the left edge of the shape representing the picture.
Top | Required | Variant | The position of the top edge of the shape representing the picture.
Width | Optional | Variant | The width of the shape representing the picture. Default is -1, meaning that the width of the shape is automatically set to 72 points if the parameter is left blank.
Height | Optional | Variant | The height of the shape representing the picture. Default is -1, meaning that the height of the shape is automatically set to 54 points if the parameter is left blank.

Return Value

Shape

Remarks

For Left, Top, Width, and Height arguments, numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "1.5 in").

The blank picture frame has the default ToolTip "Empty Picture Frame". This is changed to "Picture" when an image is selected for the Shape.

Example

This example places an empty picture frame in the center of the first page of the publication and rotates it by 45 degrees. The AlternativeText property is set to "Picture Placeholder 1" for the Web.

Copy code Copy code
Dim shpPlaceholder As Shape

Set shpPlaceholder = _
 ActiveDocument.Pages(1).Shapes.AddEmptyPictureFrame( _
 230, 320, 150, 150)

With shpPlaceholder
 .AlternativeText = "Picture Placeholder 1"
 .Rotation = 45
End With


Shape.TextWrap Property (Publisher)

 Copy code hover
[image]

Shape.TextWrap Property (Publisher)
Send feedback

Returns a WrapFormat object that represents the properties for wrapping text around a shape or shape range.

Syntax

expression .TextWrap

expression A variable that represents a Shape object.

Example

The following example adds an oval to the active publication and specifies that publication text wrap around the left and right sides of the square that circumscribes the oval. There will be a 0.1-inch margin between the publication text and the top, bottom, left side, and right side of the square.

Copy code Copy code
Sub SetTextWrapFormatProperties()
 Dim shpOval As Shape

 Set shpOval = ActiveDocument.Pages(1).Shapes.AddShape(Type:=msoShapeOval, _
 Left:=36, Top:=36, Width:=100, Height:=35)
 With shpOval.TextWrap
 .Type = pbWrapTypeSquare
 .Side = pbWrapSideBoth
 .DistanceAuto = msoFalse
 .DistanceTop = InchesToPoints(0.1)
 .DistanceBottom = InchesToPoints(0.1)
 .DistanceLeft = InchesToPoints(0.1)
 .DistanceRight = InchesToPoints(0.1)
 End With
End Sub


Shape.Callout Property (Publisher)

 Copy code hover
[image]

Shape.Callout Property (Publisher)
Send feedback

Returns a CalloutFormat object representing the formatting of a line callout.

Syntax

expression .Callout

expression A variable that represents a Shape object.

Example

This example adds an oval to the active publication and a callout that points to the oval. The callout text won't have a border, but it will have a vertical accent bar that separates the text from the callout line.

VBA Copy code Copy code
Sub NewShapeItem()

 Dim shpNew As Shapes

 Set shpNew = Application.ActiveDocument.MasterPages(1).Shapes
 With shpNew
 .AddShape Type:=msoShapeOval, Left:=180, _
 Top:=200, Width:=280, Height:=130
 With .AddCallout(Type:=msoCalloutTwo, Left:=420, _
 Top:=170, Width:=170, Height:=40)
 .TextFrame.TextRange = "Big Oval"
 With .Callout
 .Accent = msoTrue
 .Border = msoFalse
 End With
 End With
 End With

End Sub


MailMergeDataSource.DataSources Property (Publisher)

 Copy code hover
[image]

MailMergeDataSource.DataSources Property (Publisher)
Send feedback

Returns the MailMergeDataSources collection that includes the parent MailMergeDataSource object. Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .DataSources

expression A variable that represents a MailMergeDataSource object.

Return Value

MailMergeDataSources


ShapeRange.Duplicate Method (Publisher)

 Copy code hover
[image]

ShapeRange.Duplicate Method (Publisher)
Send feedback

Creates a duplicate of the specified Shape or ShapeRange object, adds the new shape or range of shapes to the Shapes collection immediately after the shape or range of shapes specified originally, and then returns the new Shape or ShapeRange object.

Syntax

expression .Duplicate

expression A variable that represents a ShapeRange object.

Return Value

ShapeRange

Example

This example adds a new, blank page at the end of the active publication, adds a diamond shape to the new page, duplicates the diamond, and then sets properties for the duplicate. The first diamond will have the default fill color for the active color scheme; the second diamond will be offset from the first one and will have the first accent color for the active color scheme.

VBA Copy code Copy code
Dim pgTemp As Page
Dim shpTemp As Shape

Set pgTemp = ActiveDocument.Pages.Add(Count:=1, After:=1)
Set shpTemp = pgTemp.Shapes _
 .AddShape(Type:=msoShapeDiamond, _
 Left:=10, Top:=10, Width:=250, Height:=350)

With shpTemp.Duplicate
 .Left = 150
 .Fill.ForeColor.SchemeColor = pbSchemeColorAccent1
End With


Options Methods (Publisher)

 Copy code hover
[image]

Options Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
ResetTips | Resets tippages so that a user can view them when using features that have been used before.
ResetWizardSynchronizing | Resets the data that Microsoft Publisher uses to automatically change similar objects to have the same formatting or content.


Application.TemplateFolderPath Property (Publisher)

 Copy code hover
[image]

Application.TemplateFolderPath Property (Publisher)
See also Send feedback

Returns a String that represents the location where Microsoft Publisher templates are stored. Read-only.

Syntax

expression .TemplateFolderPath

expression A variable that represents a Application object.

Return Value

String

Example

This example creates a new publication and edits the master page to contain a page number in a star in the upper-left corner of the page; then it saves the new publication to the template folder location so that it can be used as a template.

VBA Copy code Copy code
Sub CreateNewPubTemplate()
 Dim AppPub As Application
 Dim DocPub As Document
 Dim strFolder As String

 Set AppPub = New Publisher.Application
 Set DocPub = AppPub.NewDocument
 AppPub.ActiveWindow.Visible = True
 strFolder = AppPub.TemplateFolderPath

 With DocPub
 With .MasterPages(1).Shapes.AddShape _
 (Type:=msoShape5pointStar, Left:=36, _
 Top:=36, Width:=50, Height:=50)
 .Fill.ForeColor.RGB = RGB(Red:=255, Green:=0, Blue:=0)
 With .TextFrame.TextRange
 .InsertPageNumber
 .ParagraphFormat.Alignment = pbParagraphAlignmentCenter
 With .Font
 .Bold = msoTrue
 .Color.RGB = RGB(Red:=255, Green:=255, Blue:=255)
 .Size = 12
 End With
 End With
 End With
 .SaveAs FileName:=strFolder & "\NewPubTemplt.pub"
 End With
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Shape.ThreeD Property (Publisher)

 Copy code hover
[image]

Shape.ThreeD Property (Publisher)
Send feedback

Returns a ThreeDFormat object.

Syntax

expression .ThreeD

expression A variable that represents a Shape object.

Remarks

Use the ThreeD property to return a ThreeDFormat object whose properties are used to format the 3-D appearance of the specified shape.

Example

This example sets the depth, extrusion color, extrusion direction, and lighting direction for the 3-D effects applied to shape one in the active publication.

Copy code Copy code
Dim tdfTemp As ThreeDFormat

Set tdfTemp = _
 ActiveDocument.Pages(1).Shapes(1).ThreeD

With tdfTemp
 .Visible = True
 .Depth = 50
 .ExtrusionColor.RGB = RGB(255, 100, 255)
 .SetExtrusionDirection _
 PresetExtrusionDirection:=msoExtrusionTop
 .PresetLightingDirection = msoLightingLeft
End With


WebNavigationBarHyperlinks.Application Property (Publisher)

 Copy code hover
[image]

WebNavigationBarHyperlinks.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a WebNavigationBarHyperlinks object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Font.Application Property (Publisher)

 Copy code hover
[image]

Font.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a Font object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


MasterPages Properties (Publisher)

 Copy code hover
[image]

MasterPages Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Item | Returns the specified Page object from a Pages or MasterPages collection. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


LineFormat.GradientStyle Property (Publisher)

 Copy code hover
[image]

LineFormat.GradientStyle Property (Publisher)
See also Send feedback

Returns the gradient style for the specified line. Read-only.

Version Information

Version Added: Publisher 2013

Syntax

expression .GradientStyle

expression A variable that represents a LineFormat object.

Return value

MsoGradientStyle

Remarks

Attempting to return this property for a line that doesn't have a gradient generates an error. Use the Type property to determine whether the line has a gradient.

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


WebListBox.Parent Property (Publisher)

 Copy code hover
[image]

WebListBox.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a WebListBox object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


ShapeRange.ThreeD Property (Publisher)

 Copy code hover
[image]

ShapeRange.ThreeD Property (Publisher)
Send feedback

Returns a ThreeDFormat object.

Syntax

expression .ThreeD

expression A variable that represents a ShapeRange object.

Remarks

Use the ThreeD property to return a ThreeDFormat object whose properties are used to format the 3-D appearance of the specified shape.

Example

This example sets the depth, extrusion color, extrusion direction, and lighting direction for the 3-D effects applied to shape one in the active publication.

Copy code Copy code
Dim tdfTemp As ThreeDFormat

Set tdfTemp = _
 ActiveDocument.Pages(1).Shapes(1).ThreeD

With tdfTemp
 .Visible = True
 .Depth = 50
 .ExtrusionColor.RGB = RGB(255, 100, 255)
 .SetExtrusionDirection _
 PresetExtrusionDirection:=msoExtrusionTop
 .PresetLightingDirection = msoLightingLeft
End With


Font.AllCaps Property (Publisher)

 Copy code hover
[image]

Font.AllCaps Property (Publisher)
Send feedback

Returns or sets msoTrue if the font is formatted as all capital letters, or returns one of the other MsoTriState constants if it is not. Read/write.

Syntax

expression .AllCaps

expression A variable that represents a Font object.

Return Value

MsoTriState

Remarks

Setting the AllCaps property to msoTrue sets the SmallCaps property to msoFalse, and vice versa.

The AllCaps property value can be one of the MsoTriState constants declared in the Microsoft Office type library.

Example

This example checks the selected text in the active document for text formatted as all capital letters. For this example to work, there must be be an active publication with text selected.

Copy code Copy code
Public Sub Caps()

 If Publisher.ActiveDocument.Selection _
 .TextRange.Font.AllCaps = msoTrue Then
 MsgBox "Text is all caps."
 Else
 MsgBox "Text is not all caps."
 End If

End Sub

This example formats the selected text as all capital letters. For this code to execute properly, an active document must exist with selected text.

Copy code Copy code
Public Sub MakeCaps()

 If Publisher.ActiveDocument.Selection.TextRange _
 .Font.AllCaps = msoFalse Then
 Selection.TextRange.Font.AllCaps = msoTrue
 Else
 MsgBox "You need to select some text or it is already all caps."
 End If

End Sub


ParagraphFormat.LineSpacingRule Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.LineSpacingRule Property (Publisher)
Send feedback

Returns or sets a PbLineSpacingRule that represents the line spacing for the specified paragraphs. Read/write.

Syntax

expression .LineSpacingRule

expression A variable that represents a ParagraphFormat object.

Return Value

PbLineSpacingRule

Remarks

The LineSpacingRule property value can be one of the PbLineSpacingRule constants declared in the Microsoft Publisher type library.

Example

This example formats the paragraph at the cursor position to double spacing.

VBA Copy code Copy code
Sub SetLineSpacing()
 Selection.TextRange.ParagraphFormat
 .LineSpacingRule = pbLineSpacingDouble
End Sub


BorderArtFormat.Set Method (Publisher)

 Copy code hover
[image]

BorderArtFormat.Set Method (Publisher)
See also Send feedback

Sets the type of BorderArt applied to the specified shape.

Syntax

expression .Set(BorderArtName)

expression A variable that represents a BorderArtFormat object.

Parameters

Name | Required/Optional | Data Type | Description
BorderArtName | Required | Variant | The name of the BorderArt type applied to the specified shape.

Remarks

You can also set the type of BorderArt applied to a shape using the Name property.

Example

The following example tests for the existence of BorderArt on each shape for each page of the active document. Any BorderArt found is set to the same type.

Copy code Copy code
Sub SetBorderArt()
Dim anyPage As Page
Dim anyShape As Shape
Dim strBorderArtName As String

strBorderArtName = Document.BorderArts(1).Name

For Each anyPage in ActiveDocument.Pages
 For Each anyShape in anyPage.Shapes
 With anyShape.BorderArt
 If .Exists = True Then
 .Set(strBorderArtName)
 End If
 End With
 Next anyShape
 Next anyPage
End Sub

See also

Concepts

BorderArtFormat Object

Other resources

BorderArtFormat Object Members


ReflectionFormat.Blur Property (Publisher)

 Copy code hover
[image]

ReflectionFormat.Blur Property (Publisher)
See also Send feedback

Returns or sets a Single that specifies the degree of blur effect applied to the specified object. Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .Blur

expression A variable that represents a ReflectionFormat object.

Return value

Single

See also

Other resources

ReflectionFormat Object Members
ReflectionFormat Object


EmailMergeEnvelope Members (Publisher)

 Copy code hover
[image]

EmailMergeEnvelope Members (Publisher)
Send feedback

Represents the e-mail container (envelope) that holds the Microsoft Publisher document that is merged into an e-mail merge.

Properties

Name | Description
Application | Returns an Application object that represents the creator of the parent EmailMergeEnvelope object. Read-only.
Attachemts | Gets the list of a merged e-mail message's attachments. Read-only.
Bcc | Gets or sets a semicolon-delimited list of e-mail addresses that receive a blind carbon copy (BCC) of the e-mail message. Read/write.
Cc | Gets or sets the MailMergeDataField object that represents the data-source field (column) that lists the e-mail addresses of recipients you want to receive a carbon copy (CC) of the merged e-mail message. Read/write.
Parent | Returns the parent of the EmailMergeEnvelope object. Read-only.
Priority | Gets or sets the priority of the merged e-mail message represented by the parent EmailMergeEnvelope object. Read/write.
Subject | Gets or sets the subject line of the merged e-mail message. Read/write.
To | Gets or sets the MailMergeDataField object that represents the data-source field (column) that lists the e-mail addresses of recipients of the merged e-mail message. Read/write.


HeaderFooter.Delete Method (Publisher)

 Copy code hover
[image]

HeaderFooter.Delete Method (Publisher)
Send feedback

Deletes the specified object.

Syntax

expression .Delete

expression A variable that represents a HeaderFooter object.

Remarks

A run-time error occurs if the specified object does not exist.


PbPublicationType Enumeration (Publisher)

 Copy code hover
[image]

PbPublicationType Enumeration (Publisher)
Send feedback

Represents the type of the specified publication.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbTypePrint | 1 | Print publication
pbTypeWeb | 2 | Web publication


TextRange.Characters Method (Publisher)

 Copy code hover
[image]

TextRange.Characters Method (Publisher)
Send feedback

Returns a TextRange object that represents the specified subset of text characters.

Syntax

expression .Characters(Start, Length)

expression A variable that represents a TextRange object.

Parameters

Name | Required/Optional | Data Type | Description
Start | Required | Long | The first character in the returned range.
Length | Optional | Long | The number of characters to be returned. Default is 1.

Return Value

TextRange

Remarks

If Start is greater than the number of characters in the specified text, the returned range starts with the last character in the specified range.

If Length is greater than the number of characters from the specified starting character to the end of the text, the returned range contains all those characters.

Example

This example sets the text for the first shape on the first page in the active document, and then sets the font of the first two characters to 15 points and bold.

Copy code Copy code
Sub CharRange()
 Dim rngCharacters As TextRange
 Set rngCharacters = Application.ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.InsertBefore(NewText:="Hello World.")
 With rngCharacters.Characters(Start:=1, Length:=2).Font
 .Size = 15
 .Bold = msoTrue
 End With
End Sub


ColorCMYK.Parent Property (Publisher)

 Copy code hover
[image]

ColorCMYK.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a ColorCMYK object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


CalloutFormat Properties (Publisher)

 Copy code hover
[image]

CalloutFormat Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Accent | Returns or sets an MsoTriState constant indicating whether a vertical accent bar separates the callout text from the callout line. Read/write.
Angle | Returns or sets an MsoCalloutAngleType constant that represents the angle of the callout line. If the callout line contains more than one line segment, this property returns or sets the angle of the segment that is farthest from the callout text box. Read/write.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
AutoAttach | Returns or sets an MsoTriState constant indicating whether the place where the callout line attaches to the callout text box changes depending on whether the origin of the callout line (where the callout points) is to the left or right of the callout text box. Read/write.
AutoLength | Returns an MsoTriState constant indicating whether the first segment of the callout line is scaled when the callout is moved. Applies only to callouts whose lines consist of more than one segment (types msoCalloutThree and msoCalloutFour). Read-only.
Border | Returns or sets an MsoTriState constant indicating whether the text in the specified callout is surrounded by a border. Read/write.
Drop | For callouts with an explicitly set drop value, this property returns the vertical distance from the edge of the text bounding box to the place where the callout line attaches to the text box. This distance is measured from the top of the text box unless the AutoAttach property is set to True and the text box is to the left of the origin of the callout line (where the callout points). In this case, the drop distance is measured from the bottom of the text box. Read-only Variant.
DropType | Returns an MsoCalloutDropType constant indicating where the callout line attaches to the callout text box. Read-only.
Gap | Returns or sets a Variant indicating the horizontal distance between the end of the callout line and the text bounding box. Read/write.
Length | Returns a Variant indicating the length (in points) of the first segment of the callout line (the segment attached to the text callout box) if the AutoLength property of the specified callout is set to False. Otherwise, an error occurs. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Type | Returns or sets an MsoCalloutType constant that represents the callout type. Read/write.


Document.ViewHorizontalBaseLineGuides Property (Publisher)

 Copy code hover
[image]

Document.ViewHorizontalBaseLineGuides Property (Publisher)
Send feedback

Sets or returns a Boolean that represents whether or not the horizontal baseline guides are visible in the specified Document object. True if they are visible. False if they are not visible. Read/write.

Syntax

expression .

expression A variable that represents a Document object.

Return Value

Boolean

Remarks

The default setting for this property is False.

Example

The following example makes the horizontal baseline guides visible in the active document.

VBA Copy code Copy code
Dim objDocument As Document
Set objDocument = ActiveDocument
objDocument.ViewHorizontalBaseLineGuides = True


ColorScheme.Colors Property (Publisher)

 Copy code hover
[image]

ColorScheme.Colors Property (Publisher)
Send feedback

Returns a ColorFormat object representing a color from the specified color scheme.

Syntax

expression .Colors(ColorIndex)

expression A variable that represents a ColorScheme object.

Parameters

Name | Required/Optional | Data Type | Description
ColorIndex | Required | PbSchemeColorIndex | The color from the scheme to return based on its function in the scheme.

Return Value

ColorFormat

Remarks

The ColorIndex parameter can be one of the PbSchemeColorIndex constants declared in the Microsoft Publisher type library.

Example

The following example loops through the ColorSchemes collection and looks for color schemes where the followed hyperlink color matches the color with the RGB value of 128.

VBA Copy code Copy code
Dim cscLoop As ColorScheme
Dim colTemp As ColorFormat

For Each cscLoop In Application.ColorSchemes
 With cscLoop
 Set colTemp = .Colors(ColorIndex:=pbSchemeColorFollowedHyperlink)
 If colTemp.RGB = RGB(128, 0, 0) Then
 Debug.Print "Color scheme '" & .Name _
 & "' has a followed hyperlink " _
 & "color matching RGB(128, 0, 0)"
 End If
 End With
Next cscLoop


Shapes.BuildFreeform Method (Publisher)

 Copy code hover
[image]

Shapes.BuildFreeform Method (Publisher)
Send feedback

Builds a freeform object. Returns a FreeformBuilder object that represents the freeform as it is being built.

Syntax

expression .BuildFreeform(EditingType, X1, Y1)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
EditingType | Required | MsoEditingType | Specifies the editing type of the first node.
X1 | Required | Variant | The horizontal position of the first node in the freeform drawing relative to the upper-left corner of the page.
Y1 | Required | Variant | The vertical position of the first node in the freeform drawing relative to the upper-left corner of the page.

Return Value

FreeformBuilder

Remarks

The EditingType parameter can be one of the following MsoEditingType constants declared in the Microsoft Office type library.

msoEditingAuto | Adds a node type appropriate to the segments being connected.
msoEditingCorner | Adds a corner node.

Example

For the X1 and Y1 arguments, numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

Use the AddNodes method to add segments to the freeform. After you have added at least one segment to the freeform, you can use the ConvertToShape method to convert the FreeformBuilder object into a Shape object that has the geometric description you've defined in the FreeformBuilder object.

VBA Copy code Copy code
' Add a new freeform object.
With ActiveDocument.Shapes _
 .BuildFreeform(EditingType:=msoEditingCorner, _
 X1:=100, Y1:=100)

 ' Add three more nodes and close the polygon.
 .AddNodes SegmentType:=msoSegmentCurve, _
 EditingType:=msoEditingCorner, _
 X1:=200, Y1:=200, X2:=225, Y2:=250, X3:=250, Y3:=200
 .AddNodes SegmentType:=msoSegmentCurve, _
 EditingType:=msoEditingAuto, X1:=200, Y1:=100
 .AddNodes SegmentType:=msoSegmentLine, _
 EditingType:=msoEditingAuto, X1:=150, Y1:=50
 .AddNodes SegmentType:=msoSegmentLine, _
 EditingType:=msoEditingAuto, X1:=100, Y1:=100

 ' Convert the polygon to a Shape object.
 .ConvertToShape
End With


CaptionStyles.Parent Property (Publisher)

 Copy code hover
[image]

CaptionStyles.Parent Property (Publisher)
Send feedback

Returns the parent of the CaptionStyles collection. Read-only.

Syntax

expression .Parent

expression A variable that represents a CaptionStyles object.


PhoneticGuide.Parent Property (Publisher)

 Copy code hover
[image]

PhoneticGuide.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a PhoneticGuide object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


MailMerge Members (Publisher)

 Copy code hover
[image]

MailMerge Members (Publisher)
Send feedback

Represents the mail merge and catalog merge functionality in Microsoft Publisher.

Methods

Name | Description
CreateShortcut | Creates a shortcut to the file that contains the list of recipients or products for a mail merge publication.
Execute | Performs the specified mail merge or catalog merge operation. Returns a Document object that represents the new or existing publication specified as the destination of the merge results. Returns Nothing if the merge is executed to a printer.
ExportRecipientList | Exports the list of mail-merge recipients to a Microsoft Office Access (.mdb) file or to a comma-delimited text (.csv) file.
OpenDataSource | Attaches a data source to the specified publication, which becomes a main publication if it is not one already.
ShowWizardEx | Displays the specified catalog or mail merge wizard in a document.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
DataSource | Returns a MailMergeDataSource object that refers to the data source attached to a mail merge or catalog merge main publication.
DocumentUpdating | Returns or sets a Boolean indicating whether the screen is updated while mail merge code is running. Default is True (the screen is updated). Read/write.
EmailMergeEnvelope | Returns the EmailMergeEnvelope object associated with the parent MailMerge object. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
SuppressBlankLines | True to suppress blank lines when mail merge fields in a mail merge main document are empty. Read/write Boolean.
Type | Gets or sets the type of mail merge represented by the parent MailMerge object. Read/write.
ViewMailMergeFieldCodes | True if merge field names are displayed in a mail merge publication; False if information from the current record is displayed. Read/write Boolean. .
WizardState | Returns or sets a Long indicating the current Mail Merge wizard step for a publication. The WizardState property returns a number that equates to the current Mail Merge wizard step; a zero (0) means the Mail Merge wizard is closed. Read/write.


Application.PointsToMillimeters Method (Publisher)

 Copy code hover
[image]

Application.PointsToMillimeters Method (Publisher)
See also Send feedback

Converts a measurement from points to millimeters (1 mm = 2.835 points). Returns the converted measurement as a Single.

Syntax

expression .PointsToMillimeters(Value)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Value | Required | Single | The point value to be converted to millimeters.

Return Value

Single

Remarks

Use the MillimetersToPoints method to convert measurements in millimeters to points.

Example

This example converts measurements in points entered by the user to measurements in centimeters.

Copy code Copy code
Dim strInput As String
Dim strOutput As String

Do While True
 ' Get input from user.
 strInput = InputBox( _
 Prompt:="Enter measurement in points (0 to cancel): ", _
 Default:="0")

 ' Exit the loop if user enters zero.
 If Val(strInput) = 0 Then Exit Do

 ' Evaluate and display result.
 strOutput = Trim(strInput) & " points = " _
 & Format(Application _
 .PointsToMillimeters(Value:=Val(strInput)), _
 "0.00") & " mm"

 MsgBox strOutput
Loop

See also

Concepts

Application Object

Other resources

Application Object Members


TextEffectFormat.Text Property (Publisher)

 Copy code hover
[image]

TextEffectFormat.Text Property (Publisher)
Send feedback

Returns or sets a String that represents the text in a text range or WordArt shape. Read/write.

Syntax

expression .Text

expression A variable that represents a TextEffectFormat object.

Example

The following example changes the text and sets the font name and formatting properties for shape one on the first page of the active publication. For this example to work, shape one must be a WordArt object.

VBA Copy code Copy code
Sub FormatWordArt()
 With ActiveDocument.Pages(1).Shapes(1).TextEffect
 .Text = "This is a test."
 .FontName = "Courier New"
 .FontBold = True
 .FontItalic = True
 End With
End Sub


MailMergeDataField.AddToRecipientFields Method (Publisher)

 Copy code hover
[image]

MailMergeDataField.AddToRecipientFields Method (Publisher)
Send feedback

Adds the parent MailMergeDataField object from a particular data source to the master data source (collection of data fields) for a mail-merge publication.

Version Information

Version Added: Publisher 2007

Syntax

expression .AddToRecipientFields

expression A variable that represents a MailMergeDataField object.

Remarks

This method works only if the parent MailMergeDataField object has not already been mapped to a recipient field. You can use the IsMapped property of the MailMergeDataField object to determine if the object has already been mapped.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the AddToRecipientFields method to add a data field (column) in a particular data source to the master data source (combined recipient list) for the publication.

Before running this macro, replace datasourceindex with the index number of a valid data source in the data source collection of the active document, and replace fieldname with the name of the field in the data source that you want to add to the combined list of recipient fields.

See the Item method topic for an example of how you can use the Name property of the DataSource object to determine the index number of the data source you want.

VBA Copy code Copy code
Public Sub AddToRecipientFields_Example()

 Dim pubMailMergeDataSources As Publisher.MailMergeDataSources
 Dim pubMailMergeDataField As Publisher.MailMergeDataField

 Set pubMailMergeDataSources = ThisDocument.MailMerge.DataSource.DataSources
 Set pubMailMergeDataField = pubMailMergeDataSources.Item(datasourceindex).DataFields.Item("fieldname")

 If pubMailMergeDataField.IsMapped Then

 Debug.Print "This field is already mapped!"

 Else

 pubMailMergeDataField.AddToRecipientFields
 Debug.Print "Field added successfully. (You can verify this by looking at the recipient or product list in the UI.)"

 End If

End Sub


PbMailMergeDataFieldType Enumeration (Publisher)

 Copy code hover
[image]

PbMailMergeDataFieldType Enumeration (Publisher)
Send feedback

Represents the type of data contained in the data field.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbMailMergeDataFieldPicture | 1 | Contains a picture.
pbMailMergeDataFieldString | 0 | Contains a string.


Page.LayoutGuides Property (Publisher)

 Copy code hover
[image]

Page.LayoutGuides Property (Publisher)
Send feedback

Returns a LayoutGuides object consisting of the margin and grid layout guides for all pages including master pages in the publication.

Syntax

expression .LayoutGuides

expression A variable that represents a Page object.

Example

The following example changes the grid layout guides so that there are three columns and five rows.

Copy code Copy code
Dim layTemp As LayoutGuides

Set layTemp = ActiveDocument.LayoutGuides

With layTemp
 .Rows = 5
 .Columns = 3
End With


FindReplace.Clear Method (Publisher)

 Copy code hover
[image]

FindReplace.Clear Method (Publisher)
Send feedback

Removes the specified search criteria in a find or replace operation.

Syntax

expression .Clear

expression A variable that represents a FindReplace object.


Document.Application Property (Publisher)

 Copy code hover
[image]

Document.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a Document object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


ThreeDFormat.FieldOfView Property (Publisher)

 Copy code hover
[image]

ThreeDFormat.FieldOfView Property (Publisher)
See also Send feedback

Returns or sets a Single that represents the amount of perspective for a shape. Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .FieldOfView

expression A variable that represents a ThreeDFormat object.

Return value

Single

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ShapeRange.PickUp Method (Publisher)

 Copy code hover
[image]

ShapeRange.PickUp Method (Publisher)
Send feedback

Copies formatting from a shape or shape range so that it can be copied to another shape or shape range using the Apply method.

Syntax

expression .PickUp

expression A variable that represents a ShapeRange object.

Remarks

You must use the PickUp method to copy the formatting from a shape or shape range before using the Apply method; otherwise, an error occurs.

Example

The following example copies the formatting from the first shape of the active publication to the second shape of the active publication.

Copy code Copy code
With ActiveDocument.Pages(1)
 .Shapes(1).PickUp
 .Shapes(2).Apply
End With


FindReplace.MatchKashida Property (Publisher)

 Copy code hover
[image]

FindReplace.MatchKashida Property (Publisher)
Send feedback

Sets or returns a Boolean representing whether or not a search operation will match kashidas. Read/write.

Syntax

expression .MatchKashida

expression A variable that represents a FindReplace object.

Return Value

Boolean

Remarks

This property may not be available depending on the language enabled on your operating system. The default value is False.

Returns Access denied if Arabic is not enabled.

Example

This example finds the first occurrence of the word "" in an Arabic document matching kashidas.

Copy code Copy code
Dim objDocument As Document

Set objDocument = ActiveDocument
With objDocument.Find
 .Clear
 .FindText = ""
 .MatchKashida = True
 .Execute
End With

This example follows from the previous one except that kashidas will not be matched. Therefore the words "" or "" will both be found because kashidas will be ignored.

Copy code Copy code
Dim objDocument As Document

Set objDocument = ActiveDocument
With objDocument.Find
 .Clear
 .FindText = "مــــحـــمـــــد"
 .MatchKashida = False
 .Execute
End With


BorderArt.Application Property (Publisher)

 Copy code hover
[image]

BorderArt.Application Property (Publisher)
See also Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a BorderArt object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next

See also

Concepts

BorderArt Object

Other resources

BorderArt Object Members


Font.ExpandUsingKashida Property (Publisher)

 Copy code hover
[image]

Font.ExpandUsingKashida Property (Publisher)
Send feedback

Returns or sets an MsoTriState constant indicating whether to apply kashida rules while applying tracking to Arabic text. Read/write.

Syntax

expression .ExpandUsingKashida

expression A variable that represents an Font object.

Return Value

MsoTriState

Remarks

The ExpandUsingKashida property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | Microsoft Publisher does not apply kashida rules while applying tracking to Arabic text.
msoTriStateMixed | Return value indicating a combination of msoTrue and msoFalse for the specified text range.
msoTriStateToggle | Set value that switches between msoTrue and msoFalse.
msoTrue | Publisher does apply kashida rules while applying tracking to Arabic text.

Example

The following example sets Publisher to apply kashida rules while applying tracking to Arabic text for all text ranges on page one of the active publication.

VBA Copy code Copy code
Dim shpLoop As Shape

For Each shpLoop In ActiveDocument.Pages(1).Shapes
 If shpLoop.HasTextFrame Then
 shpLoop.TextFrame.TextRange _
 .Font.ExpandUsingKashida = msoTrue
 End If
Next shpLoop


TextEffectFormat.Application Property (Publisher)

 Copy code hover
[image]

TextEffectFormat.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a TextEffectFormat object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Options.HyphenationZone Property (Publisher)

 Copy code hover
[image]

Options.HyphenationZone Property (Publisher)
Send feedback

Returns or sets a Variant that represents the maximum amount of space that Microsoft Publisher leaves between the end of the last word in a line and the right margin. Read/write.

Syntax

expression .HyphenationZone

expression A variable that represents a Options object.

Return Value

Variant

Example

This example turns on automatic hyphenation and specifies the maximum amount of space between the end of the last word and the right margin equal to one inch (72 points).

Copy code Copy code
Sub SetHyphenationZone()
 With Options
 .AutoHyphenate = True
 .HyphenationZone = 72
 End With
End Sub


ObjectVerbs.Parent Property (Publisher)

 Copy code hover
[image]

ObjectVerbs.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents an ObjectVerbs object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Hyperlinks Properties (Publisher)

 Copy code hover
[image]

Hyperlinks Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Item | Returns an individual object from a specified collection. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


WrapFormat Members (Publisher)

 Copy code hover
[image]

WrapFormat Members (Publisher)
Send feedback

Represents all the properties for wrapping text around a shape or shape range.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
DistanceAuto | Returns or sets an MsoTriState constant indicating whether an appropriate distance between an inline shape and any surrounding text is automatically calculated. Read/write.
DistanceBottom | When the Type property of the WrapFormat object is set to pbWrapTypeSquare, returns or sets a Variant that represents the distance (in points) between the document text and the bottom edge of the specified shape. Read/write.
DistanceLeft | When the Type property of the WrapFormat object is set to pbWrapTypeSquare, returns or sets a Variant that represents the distance (in points) between the document text and the left edge of the specified shape. Read/write.
DistanceRight | When the Type property of the WrapFormat object is set to pbWrapTypeSquare, returns or sets a Variant that represents the distance (in points) between the document text and the right edge of the specified shape. Read/write.
DistanceTop | When the Type property of the WrapFormat object is set to pbWrapTypeSquare, returns or sets a Variant that represents the distance (in points) between the document text and the top edge of the specified shape. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Side | Returns or sets a PbWrapSideType constant that indicates whether text should wrap around a shape. Read/write.
Type | Specifies how text wraps around the specified shape. Read/write.


ParagraphFormat.SpaceBefore Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.SpaceBefore Property (Publisher)
Send feedback

Returns or sets a Variant that represents the amount of spacing (in points) before one or more paragraphs. Read/write.

Syntax

expression .SpaceBefore

expression A variable that represents a ParagraphFormat object.

Return Value

Variant

Example

This example sets the spacing before and after the third paragraph in the first shape on the first page of the active publication to 6 points. This example assumes there is at least one shape on the first page of the active publication.

VBA Copy code Copy code
Sub SetSpacingBeforeAfterParagraph()
 With ActiveDocument.Pages(1).Shapes(1).TextFrame _
 .TextRange.Paragraphs(3).ParagraphFormat
 .SpaceBefore = 6
 .SpaceAfter = 6
 End With
End Sub

This example sets spacing before and after all paragraphs in the first shape on the first page of the active publication to 6 points. This example assumes there is at least one shape on the first page of the active publication.

VBA Copy code Copy code
Sub SetSpacingBeforeAfterAllParagraph()
 With ActiveDocument.Pages(1).Shapes(1).TextFrame _
 .TextRange.ParagraphFormat
 .SpaceBefore = 12
 .SpaceAfter = 6
 End With
End Sub


LayoutGuides.Parent Property (Publisher)

 Copy code hover
[image]

LayoutGuides.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a LayoutGuides object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


ShapeRange Properties (Publisher)

 Copy code hover
[image]

ShapeRange Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Adjustments | Returns an Adjustments collection representing all adjustment handles for the specified Shape or ShapeRange object.
AlternativeText | Returns or sets a String representing the text displayed by a Web browser in place of the Shape object while the Shape object is being downloaded or when graphics are turned off. Read/write.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
AutoShapeType | Returns or sets an MsoAutoShapeType constant that specifies a ShapeRange object's AutoShape type.
BlackWhiteMode | Returns or sets an MsoBlackWhiteMode constant indicating how the specified shape or shape range appears when the publication is viewed in black-and-white mode. Read/write.
Callout | Returns a CalloutFormat object representing the formatting of a line callout.
ConnectionSiteCount | Returns a Long indicating the count of connection sites on the current Shape object. Read-only.
Connector | Returns an MsoTriState value indicating whether the specified shape is a connector. Read-only.
ConnectorFormat | Returns a ConnectorFormat object that contains connector formatting properties. Applies to Shape or ShapeRange objects that represent connectors.
Count | Returns a Long that represents the number of items in the specified collection.
Fill | Returns a FillFormat object representing the fill for the specified shape or table cell.
Glow | Returns a GlowFormat object that represents the glow formatting for a range of shapes. Read-only.
GroupItems | Returns a GroupShapes collection if the specified shape is a group.
HasTable | Returns msoTrue if the shape represents a TableFrame object or msoFalse if the shape represents any other object type. Read-only.
HasTextFrame | Indicates whether the specified shape has a TextFrame object associated with it. Read-only.
Height | Returns a Variant that represents the height (in points) of a specified range of shapes. Read-only.
HorizontalFlip | Indicates whether the specified shape has been flipped around its horizontal axis. Read-only.
Hyperlink | Returns a Hyperlink object representing the hyperlink associated with the specified shape.
ID | Returns a Long that represents the type of a shape, range of shapes, or property, type, or value of a wizard. Read-only.
InlineAlignment | Returns or sets a PbInlineAlignment constant that indicates whether an inline shape has left, right, or in-text alignment. Read/write.
InlineTextRange | Returns a TextRange object that reflects the position of the inline shape in its containing text range. Read-only.
IsInline | Returns an MsoTriState constant that specifies whether a shape is inline. Read-only.
Left | Returns a Variant indicating the distance from the left edge of the page to the leftmost edge of all the shapes in the specified shape range. Numeric values are in points; all other values are in any measurement supported by Publisher (for example, "2.5 in"). Read-only.
Line | Returns a LineFormat object that contains line formatting properties for the specified shape. (For a line, the LineFormat object represents the line itself; for a shape with a border, the LineFormat object represents the border.).
LinkFormat | Returns a LinkFormat object that contains the properties that are unique to linked OLE objects. Read-only.
LockAspectRatio | Returns or sets an MsoTriState constant indicating whether the specified shape retains its original proportions when you resize it. Read/write.
Name | Returns or sets a String value indicating the name of the specified object. Read/write.
Nodes | Returns a ShapeNodes collection that represents the geometric description of the specified shape. Applies to Shape or ShapeRange objects that represent freeform drawings.
OLEFormat | Returns an OLEFormat object that contains OLE formatting properties for the specified shape. Applies to Shape or ShapeRange objects that represent OLE objects.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
PictureFormat | Returns a PictureFormat object that contains picture formatting properties for the specified object. Applies to Shape or ShapeRange objects that represent pictures or OLE objects. Read-only.
Reflection | Returns a ReflectionFormat object that represents the reflection formatting for a range of shapes. Read-only.
Rotation | Returns or sets a Single that represents the number of degrees the specified shape is rotated around the z-axis. A positive value indicates clockwise rotation; a negative value indicates counterclockwise rotation. Read/write.
Shadow | Returns a ShadowFormat object that represents the shadow formatting for the specified shape.
SoftEdge | Returns a SoftEdgeFormat object that represents the soft edge formatting for a range of shapes. Read-only.
Table | Returns a Table object that represents a table in Microsoft Publisher.
Tags | Returns a Tags collection representing tags or custom properties applied to a shape, shape range, page, or publication.
TextEffect | Returns a TextEffectFormat object that represents the text formatting properties of a WordArt object.
TextFrame | Returns a TextFrame object that represents the text in a shape and the properties that control the margins and orientation of the text.
TextWrap | Returns a WrapFormat object that represents the properties for wrapping text around a shape or shape range.
ThreeD | Returns a ThreeDFormat object.
Top | Returns a Variant that represents the distance between the top of the page and the top shape in a range of shapes. Read-only.
Type | Specifies the shape type. Read-only.
VerticalFlip | Returns msoTrue if the specified shape has been flipped around its vertical axis. Read-only.
Vertices | Returns the coordinates of the specified freeform drawing's vertices (and control points for Bézier curves) as a series of coordinate pairs. Read-only Variant.
Width | Returns a Variant that represents the width (in points) of a specified range of shapes. Read-only.
Wizard | Returns a Wizard object representing the publication design associated with the specified publication or the wizard associated with the specified Design Gallery object.
WizardTag | Returns or sets a PbWizardTag constant indicating the function of a specified shape with respect to its publication design. Read/write.
WizardTagInstance | Returns or sets a Long indicating the instance of the specified shape compared with other shapes having the same wizard tag. Read/write.
ZOrderPosition | Returns a Long indicating the position of the specified shape or shape range in the z-order. Read-only.


GlowFormat Properties (Publisher)

 Copy code hover
[image]

GlowFormat Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Color | Returns a ColorFormat object that represents the color for a glow effect. Read-only.
Radius | Returns or sets a Single that represents the length of the radius for a glow effect. Read/write.
Transparency | Returns or sets the degree of transparency for the glow effect as a value between 0.0 (opaque) and 1.0 (clear). Read/write Single.
Visible | True if the specified object or the formatting applied to it is visible. Read/write MsoTriState.


CalloutFormat.AutoLength Property (Publisher)

 Copy code hover
[image]

CalloutFormat.AutoLength Property (Publisher)
Send feedback

Returns an MsoTriState constant indicating whether the first segment of the callout line is scaled when the callout is moved. Applies only to callouts whose lines consist of more than one segment (types msoCalloutThree and msoCalloutFour). Read-only.

Syntax

expression .AutoLength

expression A variable that represents a CalloutFormat object.

Return Value

MsoTriState

Remarks

The AutoLength property value can be one of the MsoTriState constants declared in the Microsoft Office type library.

Use the AutomaticLength method to set this property to msoTrue, and use the CustomLength method to set this property to msoFalse.

Example

This example switches between an automatically-scaling first segment and one with a fixed length for the callout line for the first shape in the publication. For the example to work, the shape must be a callout.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes(1).Callout
 If .AutoLength Then
 .CustomLength Length:=50
 Else
 .AutomaticLength
 End If
End With


ThreeDFormat.BevelBottomType Property (Publisher)

 Copy code hover
[image]

ThreeDFormat.BevelBottomType Property (Publisher)
See also Send feedback

Returns or sets an MsoPresetCamera constant that represents the bevel type for the bottom bevel. Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .BevelBottomType

expression A variable that represents a ThreeDFormat object.

Return value

MSOBEVELTYPE

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


BuildingBlock.Gallery Property (Publisher)

 Copy code hover
[image]

BuildingBlock.Gallery Property (Publisher)
Send feedback

A PbBuildingBlockGallery constant that indicates the building block gallery on the ribbon that contains the specified building block, if ShowInGallery is True. Read/write.

Syntax

expression .Gallery

expression A variable that represents a BuildingBlock object.


ConnectorFormat.BeginConnected Property (Publisher)

 Copy code hover
[image]

ConnectorFormat.BeginConnected Property (Publisher)
Send feedback

Returns an MsoTriState constant indicating whether the beginning of the specified connector is connected to a shape. Read-only.

Syntax

expression .BeginConnected

expression A variable that represents a ConnectorFormat object.

Return Value

MsoTriState

Remarks

The BeginConnected property value can be one of the MsoTriState constants declared in the Microsoft Office type library.

Use the EndConnected property to determine if the end of a connector is connected to a shape.

Example

If the third shape on the first page in the active publication is a connector whose beginning is connected to a shape, this example stores the connection site number, stores a reference to the connected shape, and then disconnects the beginning of the connector from the shape.

Copy code Copy code
Dim intSite As Integer
Dim shpConnected As Shape

With ActiveDocument.Pages(1).Shapes(3)

 ' Test whether shape is a connector.
 If .Connector Then
 With .ConnectorFormat

 ' Test whether connector is connected to another shape.
 If .BeginConnected Then

 ' Store connection site number.
 intSite = .BeginConnectionSite

 ' Set reference to connected shape.
 Set shpConnected = .BeginConnectedShape

 ' Disconnect connector and shape.
 .BeginDisconnect
 End If
 End With
 End If
End With


MailMerge.Execute Method (Publisher)

 Copy code hover
[image]

MailMerge.Execute Method (Publisher)
Send feedback

Performs the specified mail merge or catalog merge operation. Returns a Document object that represents the new or existing publication specified as the destination of the merge results. Returns Nothing if the merge is executed to a printer.

Syntax

expression .Execute(Pause, Destination, Filename)

expression A variable that represents a MailMerge object.

Parameters

Name | Required/Optional | Data Type | Description
Pause | Required | Boolean | True to have Microsoft Publisher pause and display a troubleshooting dialog box if a merge error is found. False to ignore errors during mail merge or catalog merge.
Destination | Optional | PbMailMergeDestination | The destination of the mail merge or catalog merge results. Specifying pbSendToPrinter for a catalog merge results in a run-time error.
Filename | Optional | String | The file name of the publication to which you want to append the catalog merge results.

Return Value

Document

Remarks

Destination can be one of these PbMailMergeDestination constants. The default is pbSendToPrinter.

pbSendToPrinter

pbMergeToNewPublication

pbMergeToExistingPublication

Example

This example executes a mail merge if the active publication is a main document with an attached data source.

VBA Copy code Copy code
Sub ExecuteMerge()
 Dim mrgDocument As MailMerge
 Set mrgDocument = ActiveDocument.MailMerge
 If mrgDocument.DataSource.ConnectString <> "" Then
 mrgDocument.Execute Pause:=False
 End If
End Sub


WebCommandButton.ActionURL Property (Publisher)

 Copy code hover
[image]

WebCommandButton.ActionURL Property (Publisher)
Send feedback

Returns or sets a String that represents the URL of the server-side script to execute in response to a Submit button click. Read/write.

Syntax

expression .ActionURL

expression A variable that represents a WebCommandButton object.

Return Value

String

Remarks

The default value for the ActionURL property is "http://example.microsoft.com/~user/ispscript.cgi". This property is ignored for Reset command buttons.

Example

This example creates a Web form Submit command button and sets the script path and file name to run when a user clicks the button.

Copy code Copy code
Sub CreateActionWebButton()
 With ActiveDocument.Pages(1).Shapes.AddWebControl _
 (Type:=pbWebControlCommandButton, Left:=150, _
 Top:=150, Width:=75, Height:=36).WebCommandButton
 .ButtonText = "Submit"
 .ButtonType = pbCommandButtonSubmit
 .ActionURL = "http://www.tailspintoys.com/" & _
 "scripts/ispscript.cgi"
 End With
End Sub


MailMergeDataSource.InvalidComments Property (Publisher)

 Copy code hover
[image]

MailMergeDataSource.InvalidComments Property (Publisher)
Send feedback

If the InvalidAddress property is True, this property returns or sets a String that describes invalid data in a mail merge record. Read/write.

Syntax

expression .InvalidComments

expression A variable that represents an MailMergeDataSource object.

Return Value

String

Remarks

Use the SetAllErrorFlags method to set both the InvalidAddress and InvalidComments properties for all records in a data source.

Example

This example searches the records to verify that the length of the PostalCode field for each record is at least five digits long. If it is not, the record is excluded from the mail merge and flagged as invalid.

Copy code Copy code
Sub ExcludeRecords()
 Dim intRecord As Integer
 With ActiveDocument.MailMerge
 For intRecord = 1 To .DataSource.RecordCount
 .DataSource.ActiveRecord = intRecord
 If Len(.DataSource.DataFields("PostalCode").Value) < 5 Then
 With .DataSource
 .Included = False
 .InvalidAddress = True
 .InvalidComments = "This record is removed " & _
 "from the mail merge because its postal code" & _
 "has less than five digits."
 End With
 End If
 Next
 End With
End Sub


Table Members (Publisher)

 Copy code hover
[image]

Table Members (Publisher)
Send feedback

Represents a single table.

Methods

Name | Description
ApplyAutoFormat | Applies automatic built-in table formatting to a specified table.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Cells | Returns a CellRange object that represents a range of cells in a table.
Columns | Returns a Columns collection that represents all the columns of the specified table.
GrowToFitText | True for cells in a table to increase vertically to fit text. Read/write.
Parent | Returns an object that represents the parent object of the specified object. Read-only.
Rows | Returns a Rows collection that represents all the table rows in a range, selection, or table.
TableDirection | Returns or sets a PbTableDirectionType constant that represents whether text in a table is read from left to right or from right to left. Read/write.


PbHlinkTargetType Enumeration (Publisher)

 Copy code hover
[image]

PbHlinkTargetType Enumeration (Publisher)
Send feedback

Represents the type of hyperlink.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbHlinkTargetTypeEmail | 2 | E-mail
pbHlinkTargetTypeFirstPage | 3 | First Page
pbHlinkTargetTypeLastPage | 4 | Last Page
pbHlinkTargetTypeNextPage | 5 | Next Page
pbHlinkTargetTypeNone | 0 | None
pbHlinkTargetTypePageID | 7 | Page ID
pbHlinkTargetTypePersonalized | 8 | Personalized
pbHlinkTargetTypePreviousPage | 6 | Previous Page
pbHlinkTargetTypeURL | 1 | URL


TextFrame.ValidLinkTarget Method (Publisher)

 Copy code hover
[image]

TextFrame.ValidLinkTarget Method (Publisher)
Send feedback

Determines whether the text frame of one shape can be linked to the text frame of another shape. Returns True if LinkTarget is a valid target, False if LinkTarget already contains text or is already linked, or if the shape does not support attached text.

Syntax

expression .ValidLinkTarget(LinkTarget)

expression A variable that represents a TextFrame object.

Parameters

Name | Required/Optional | Data Type | Description
LinkTarget | Required | Shape | The shape with the target text frame to which you want to link the text frame returned by expression.

Return Value

Boolean

Example

This example checks to see whether the text frames for the first and second shapes on the first page of the active publication can be linked to one another. If so, the example links the two text frames.

Copy code Copy code
Dim txtFrame1 As TextFrame
Dim txtFrame2 As TextFrame

With ActiveDocument.Pages(1)
 Set txtFrame1 = .Shapes(1).TextFrame
 Set txtFrame2 = .Shapes(2).TextFrame
End With

If txtFrame1.ValidLinkTarget(LinkTarget:=txtFrame2.Parent) = True Then
 txtFrame1.NextLinkedTextFrame = txtFrame2
End If


Shape.LockAspectRatio Property (Publisher)

 Copy code hover
[image]

Shape.LockAspectRatio Property (Publisher)
Send feedback

Returns or sets an MsoTriState constant indicating whether the specified shape retains its original proportions when you resize it. Read/write.

Syntax

expression .LockAspectRatio

expression A variable that represents a Shape object.

Remarks

The LockAspectRatio property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The height and width of the shape change independently of one another when you resize it.
msoTriStateMixed | Return value indicating a combination of msoTrue and msoFalse for the specified shape range.
msoTriStateToggle | Set value that switches between msoTrue and msoFalse.
msoTrue | The specified shape retains its original proportions when you resize it.

Example

This example adds a cube to the active publication. The cube can be moved and resized, but not reproportioned.

VBA Copy code Copy code
Dim shp As Shape

Set shp = ActiveDocument.Pages(1).Shapes _
 .AddShape(Type:=msoShapeCube, _
 Left:=50, Top:=50, Width:=100, Height:=200) _

shp.LockAspectRatio = msoTrue


WebTextBox.EchoAsterisks Property (Publisher)

 Copy code hover
[image]

WebTextBox.EchoAsterisks Property (Publisher)
Send feedback

Specifies whether asterisks should be displayed in place of text that is entered into a Web text box control. Read/write.

Syntax

expression .EchoAsterisks

expression A variable that represents an WebTextBox object.

Return Value

MsoTrue

Remarks

The EchoAsterisks property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | Displays the text entered into a Web text box control.
msoTrue | Displays asterisks in place of text entered into a Web text box control.

Example

This example creates a Web text box control, sets the maximum limit as ten characters, specifies that entry is required, and masks the entry with asterisks when a user enters into the control.

VBA Copy code Copy code
Sub AddPasswordTextBox()
 With ActiveDocument.Pages(1).Shapes.AddWebControl _
 (Type:=pbWebControlSingleLineTextBox, Left:=100, _
 Top:=100, Width:=72, Height:=15)
 .Name = "Password"
 With .WebTextBox
 .Limit = 10
 .EchoAsterisks = msoTrue
 .RequiredControl = msoTrue
 End With
 End With
End Sub


FreeformBuilder Members (Publisher)

 Copy code hover
[image]

FreeformBuilder Members (Publisher)
Send feedback

Represents the geometry of a freeform while it is being built.

Methods

Name | Description
AddNodes | Inserts a new segment at the end of the freeform that is being created, and adds the nodes that define the segment. You can use this method as many times as you want to add nodes to the freeform you are creating. When you finish adding nodes, use the ConvertToShape method to create the freeform you just defined.
ConvertToShape | Creates a shape that has the geometric characteristics of the specified FreeformBuilder object. Returns a Shape object that represents the new shape.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


ShapeRange.Align Method (Publisher)

 Copy code hover
[image]

ShapeRange.Align Method (Publisher)
Send feedback

Aligns all the shapes in the specified ShapeRange object.

Syntax

expression .Align(AlignCmd, RelativeTo)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
AlignCmd | Required | MsoAlignCmd | Specifies how the shapes are to be aligned.
RelativeTo | Required | MsoTriState | Specifies whether shapes are aligned relative to the page or to one another.

Remarks

If the RelativeTo parameter is msoFalse and the shape range contains only one shape, an error occurs.

The AlignCmd parameter can be one of the MsoAlignCmd constants declared in the Microsoft Office type library.

Constant | Description
msoAlignBottoms | Aligns shapes along their bottom edges. If RelativeTo is msoFalse, the bottommost shape determines the line against which the other shapes are aligned.
msoAlignCenters | Aligns shapes on a vertical line through their centers. If RelativeTo is msoFalse, shapes are aligned on a line halfway between the left- and rightmost shapes.
msoAlignLefts | Aligns shapes along their left edges. If RelativeTo is msoFalse, the leftmost shape determines the line against which the other shapes are aligned.
msoAlignMiddles | Aligns shapes on a horizontal line through their centers. If RelativeTo is msoFalse, shapes are aligned on a line halfway between the top- and bottommost shapes.
msoAlignRights | msoAlignRights Aligns shapes along their right edges. If RelativeTo is msoFalse, the rightmost shape determines the line against which the other shapes are aligned.
msoAlignTops | Aligns shapes along their top edges. If RelativeTo is msoFalse, the topmost shape determines the line against which the other shapes are aligned.

The RelativeTo parameter can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | Aligns shapes relative to one another.
msoTrue | Aligns shapes relative to the page.

Example

The following example aligns all the shapes on the first page of the active publication on a vertical line through their centers.

VBA Copy code Copy code
ActiveDocument.Pages(1).Shapes.Range.Align _
 AlignCmd:=msoAlignCenters, _
 RelativeTo:=msoTrue


MailMergeDataSource.Application Property (Publisher)

 Copy code hover
[image]

MailMergeDataSource.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a MailMergeDataSource object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


PictureFormat Members (Publisher)

 Copy code hover
[image]

PictureFormat Members (Publisher)
Send feedback

Contains properties and methods that apply to pictures.

Methods

Name | Description
ClearCrop | Removes a picture shape from an image, and resets the crop region to the original extent of the image before cropping. Returns nothing.
FillFrame | Fills the frame of a picture with the image represented by the PictureFormat object. Returns nothing.
FitFrame | Fits the image represented by the PictureFormat object to the frame of the picture. Returns nothing.
IncrementBrightness | Changes the brightness of the picture by the specified amount.
IncrementContrast | Changes the contrast of the picture by the specified amount.
Recolor | Changes the color of a picture in a publication.
Remove | Removes the picture from its frame, leaving in its place a picture placeholder. Any previous formatting applied to the picture is retained. Returns nothing.
Replace | Replaces the specified picture. Returns Nothing.
ReplaceEx | Replaces the specified picture, optionally fitting the replacement picture to the frame or filling the frame. Returns nothing.
RestoreOriginalColors | Restores the original colors of a picture that was recolored.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Brightness | Returns or sets a Single indicating the brightness of the specified picture or OLE object. The value for this property must be a number from 0.0 (dimmest) to 1.0 (brightest). Read/write.
ColorModel | Returns a PbColorModel constant that represents the color model of the picture. Read-only.
ColorsInPalette | Returns a Long that represents the number of colors in the picture's palette. Read-only.
ColorType | Returns or sets an MsoPictureColorType constant indicating the type of color transformation applied to the specified picture or OLE object. Read/write.
Contrast | Returns or sets a Single indicating the contrast for the specified picture or OLE object. The value for this property must be a number from 0.0 (the least contrast) to 1.0 (the greatest contrast). Read/write.
CropBottom | Returns or sets a Variant indicating the amount by which the bottom edge of a picture or OLE object is cropped. Read/write.
CropLeft | Returns or sets a Variant indicating the amount by which the left edge of a picture or OLE object is cropped. Read/write.
CropRight | Returns or sets a Variant indicating the amount by which the right edge of a picture or OLE object is cropped. Read/write.
CropTop | Returns or sets a Variant indicating the amount by which the top edge of a picture or OLE object is cropped. Read/write.
EffectiveResolution | Returns a Long that represents, in dots per inch (dpi), the effective resolution of the picture. Read-only.
Filename | Returns a String that represents the file name of the specified picture or OLE object. Read-only.
FileSize | Returns a Long that represents, in bytes, the size of the picture or OLE object as it appears in the specified publication. Read-only.
HasAlphaChannel | Returns an MsoTriState constant indicating whether the specified picture contains an alpha channel. Read-only.
HasTransparencyColor | Returns a Boolean that indicates whether a transparency color has been applied to the specified picture. Read-only.
Height | Returns a Variant that represents the height, in points, of the specified picture or OLE object. Read-only.
HorizontalPictureLocking | Returns or sets a PbHorizontalPictureLocking constant indicating where newly inserted pictures appear in relation to the specified frame. Read/write.
HorizontalScale | Returns a Long that represents the scaling of the picture along its horizontal axis. The scaling is expressed as a percentage (for example, 200 equals 200 percent scaling). Read-only.
ImageFormat | Returns a PbImageFormat constant that represents the image format of a picture as determined by Microsoft Windows Graphics Device Interface (GDI+). Read-only.
IsEmpty | Returns a MsoTriState constant that represents whether the specified shape is an empty picture frame. Read-only.
IsGreyScale | Returns a MsoTriState constant that indicates whether the picture is a greyscale image. Read-only.
IsLinked | Returns a MsoTriState constant indicating whether the specified picture is a linked picture or OLE object. Read-only.
IsRecolored | Returns True if the image represented by the parent PictureFormat object has been recolored, either in the user interface or by using the PictureFormat.Recolor method. Read-only.
IsTrueColor | Returns an MsoTriState constant indicating whether the specified picture or OLE object contains color data of 24 bits per channel or greater. Read-only.
LeaveBlackAsBlack | Returns True if, when you recolor the image represented by the parent PictureFormat object, the black parts of the original image should remain black. Read-only.
LinkedFileStatus | Returns a PbLinkedFileStatus constant that indicates the status of the file linked to the specified picture. Read-only.
OriginalColorsInPalette | Returns a Long that represents the number of colors in the specified linked picture's palette. Read-only.
OriginalFileSize | Returns a Long representing the size, in bytes, of the linked picture or OLE object. Read-only.
OriginalHasAlphaChannel | Returns an MsoTriState constant depending on whether the original, linked picture contains an alpha channel. Read-only.
OriginalHeight | Returns a Variant representing the height, in points, of the specified linked picture or OLE object. Read-only.
OriginalIsTrueColor | Returns an MsoTriState constant indicating whether the specified linked picture or OLE object contains color data of 24 bits per channel or greater. Read-only.
OriginalResolution | Returns a Long that represents, in dots per inch (dpi), the resolution at which the linked picture was originally scanned. Read-only.
OriginalWidth | Returns a Variant that represents, in points, the width of the specified linked picture or OLE object. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
RecoloredPictureColor | Returns the color that has been applied to the image represented by the parent PictureFormat object. Read-only.
TransparencyColor | Returns or sets an MsoRGBType constant that represents the transparency color. Read/write.
TransparentBackground | Indicates whether the parts of the specified picture that are defined as the transparent color appear transparent. Read/write.
VerticalPictureLocking | Returns or sets a PbVerticalPictureLocking constant indicating where newly inserted pictures appear in relation to the specified frame. Read/write.
VerticalScale | Returns a Long that represents the scaling of the picture along its vertical axis. The scaling is expressed as a percentage (for example, 200 equals 200 percent scaling). Read-only.
Width | Returns a Variant that represents the width, in points, of the specified picture. Read-only.


MasterPages.Item Property (Publisher)

 Copy code hover
[image]

MasterPages.Item Property (Publisher)
Send feedback

Returns the specified Page object from a Pages or MasterPages collection. Read-only.

Syntax

expression .Item(Item)

expression A variable that represents a MasterPages object.

Parameters

Name | Required/Optional | Data Type | Description
Item | Required | Long | The number of the page to return. For MasterPages collections, Item can either be 1 or 2 for the left and right master pages, respectively. For Pages collections, Item corresponds to a Page object's PageIndex property.

Example

This example displays the page number, page index, and page ID of the first page in the active publication.

VBA Copy code Copy code
With ActiveDocument.Pages.Item(1)
 Debug.Print "Page number = " & .PageNumber
 Debug.Print "Page index = " & .PageIndex
 Debug.Print "Page ID = " & .PageID
End With


LayoutGuides.MarginTop Property (Publisher)

 Copy code hover
[image]

LayoutGuides.MarginTop Property (Publisher)
Send feedback

Returns or sets a Variant that represents the amount of space (in points) between the text and the top edge of a cell, text frame, or page. Read/write.

Syntax

expression .MarginTop

expression A variable that represents a LayoutGuides object.

Example

This example sets the margins of the active publication to two inches.

Copy code Copy code
Sub SetPageMargins()

 With ActiveDocument.LayoutGuides
 .MarginTop = Application.InchesToPoints(Value:=2)
 .MarginBottom = Application.InchesToPoints(Value:=2)
 .MarginLeft = Application.InchesToPoints(Value:=2)
 .MarginRight = Application.InchesToPoints(Value:=2)
 End With

End Sub


ParagraphFormat Properties (Publisher)

 Copy code hover
[image]

ParagraphFormat Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Alignment | Returns or sets a PbParagraphAlignmentType constant that represents the alignment for the specified paragraphs. Read/write.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
AttachedToText | True if the Font or ParagraphFormat object is attached to a TextRange object. If the object is attached to a TextRange object, the document will be updated when properties of the object are changed. If the object is not attached, nothing in the document will be changed until the object is applied to a TextRange or Style object. Read-only Boolean.
CharBasedFirstLineIndent | Returns or sets the value of the first line indent (in East Asian character width). Read/write Long.
FirstLineIndent | Returns or sets a Variant that represents the amount of space (measured in points) to indent the first line in a paragraph. Read/write.
KashidaPercentage | Returns or sets a Long indicating the percentage by which kashidas are to be lengthened for the specified paragraphs. Valid values are from 0 to 100. Read/write.
KeepLinesTogether | Sets or returns an MsoTriState that indicates whether all lines in the specified paragraph will remain in the same text box. Read/write.
KeepWithNext | Sets or returns an MsoTriState that indicates whether the following paragraph will remain in the same text box as the specified paragraph. Read/write.
LeftIndent | Returns or sets a Variant that represents the left indent value (in points) for the specified paragraphs. Read/write.
LineSpacing | Returns or sets a Variant that represents the line spacing (in number of lines) for the specified paragraphs. Read/write.
LineSpacingRule | Returns or sets a PbLineSpacingRule that represents the line spacing for the specified paragraphs. Read/write.
ListBulletFontName | Sets or retrieves a String representing the list bullet font name from the specified paragraphs. Read/write.
ListBulletFontSize | Sets or retrieves a Single that represents the list bullet font size from the specified paragraphs. Read/write.
ListBulletText | Returns a String representing the list bullet text from the specified paragraphs. Read-only.
ListIndent | Returns or sets a Single that represents the list indent value (in points) for the specified ParagraphFormat object. Read/write.
ListNumberSeparator | Sets or retrieves a PbListSeparator constant that represents the list separator of the specified paragraphs. Read/write.
ListNumberStart | Sets or retrieves a Long that represents the starting number of a list. Read/write.
ListType | Returns a PbListType constant from the specified ParagraphFormat object. Read-only.
LockToBaseLine | Returns an MsoTristate that represents whether or not text will be positioned along baseline guides. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
RightIndent | Returns or sets a Variant that represents the right indent (in points) for the specified paragraphs. Read/write.
SpaceAfter | Returns or sets a Variant that represents the amount of spacing (in points) after one or more paragraphs. Read/write.
SpaceBefore | Returns or sets a Variant that represents the amount of spacing (in points) before one or more paragraphs. Read/write.
StartInNextTextBox | Returns or sets an MsoTriState constant that represents whether to always start the selected paragraph in the next linked text box. Read/write.
Tabs | Returns a TabStops object representing the custom and default tabs for a paragraph or group of paragraphs.
TextDirection | Returns or sets a PbTextDirection constant indicating the direction in which text flows in the specified paragraph. Read/write.
TextStyle | Returns or sets a Variant that represents the text style applied to a paragraph. Read/write.
UseCharBasedFirstLineIndent | Returns or sets an MsoTriState constant that specifies whether a paragraph is indented using East Asian character width. Read/write.
WidowControl | Sets or returns an MsoTriState that represents whether or not the first or last line of the specified paragraph can appear by itself in a text box. Read/write.


AdvancedPrintOptions.PrintBleedMarks Property (Publisher)

 Copy code hover
[image]

AdvancedPrintOptions.PrintBleedMarks Property (Publisher)
See also Send feedback

True to print bleed marks in the specified publication. The default is False. Read/write Boolean.

Syntax

expression .PrintBleedMarks

expression A variable that represents a AdvancedPrintOptions object.

Return Value

Boolean

Remarks

Bleed marks show the extent of a bleed, and print an eighth inch outside the crop marks.

This property is only accessible if bleeds are allowed in the specified publication. Use the AllowBleeds property of the AdvancedPrintOptions object to specify bleeds are allowed. Returns "Permission Denied" if bleeds are not allowed in the publication.

This property corresponds to the Bleed marks control on the Page Settings tab of the Advanced Print Settings dialog box.

Example

The following example sets the publication to allow bleeds, and to print bleed marks.

VBA Copy code Copy code
Sub AllowBleedsAndPrintMarks()
 With ActiveDocument.AdvancedPrintOptions
 .AllowBleeds = True
 .PrintBleedMarks = True
 End With
End Sub

See also

Concepts

AdvancedPrintOptions Object

Other resources

AdvancedPrintOptions Object Members


BorderArt Properties (Publisher)

 Copy code hover
[image]

BorderArt Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Name | Returns a String value indicating the name of the specified object. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


ShapeNodes.SetPosition Method (Publisher)

 Copy code hover
[image]

ShapeNodes.SetPosition Method (Publisher)
Send feedback

Sets the position of the specified node. Depending on the editing type of the node, this method may affect the position of adjacent nodes.

Syntax

expression .SetPosition(Index, X1, Y1)

expression A variable that represents a ShapeNodes object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | [INT] | The node whose position is to be set. Must be a number from 1 to the number of nodes in the specified shape; otherwise, an error occurs.
X1 | Required | Variant | The horizontal position of the node relative to the upper-left corner of the page.
Y1 | Required | Variant | The vertical position of the node relative to the upper-left corner of the page.

Remarks

For the X1 and Y1 arguments, numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

Example

This example moves the second node in the third shape in the active publication 200 points to the right and 300 points down. The shape must be a freeform drawing.

Copy code Copy code
Dim arrPoints As Variant
Dim intX As Integer
Dim intY As Integer

With ActiveDocument.Pages(1).Shapes(3).Nodes
 arrPoints = .Item(2).Points
 intX = arrPoints(1, 1)
 intY = arrPoints(1, 2)
 .SetPosition Index:=2, X1:=intX + 200, Y1:=intY + 300
End With


Field Members (Publisher)

 Copy code hover
[image]

Field Members (Publisher)
Send feedback

Represents a field. The Field object is a member of the Fields collection. The Fields collection represents the fields in a selection, range, or publication.

Methods

Name | Description
Unlink | Replaces the specified field or Fields collection with with their most recent results.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Code | Returns a String that represents the text displayed when the page view is set to show field codes. Read-only.
Next | Returns a Field object that represents the next field in a text range.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
PhoneticGuide | Returns a PhoneticGuide object that represents the properties of phonetic text applied to a text range.
Result | Returns a String that represents the result of the specified field. Read-only.
TextRange | Returns a TextRange object that represents the text that is attached to a shape and properties and methods for manipulating the text.
Type | Specifies the field type. Read-only.


ShapeNode.EditingType Property (Publisher)

 Copy code hover
[image]

ShapeNode.EditingType Property (Publisher)
Send feedback

If the specified node is a vertex, this property returns an MsoEditingType constant indicating how changes made to the node affect the two segments connected to the node. If the node is a control point for a curved segment, this property returns the editing type of the adjacent vertex. Read-only.

Syntax

expression .EditingType

expression A variable that represents an ShapeNode object.

Return Value

MsoEditingType

Remarks

Use the SetEditingType method to set the value of this property.

The EditingType property value can be one of the MsoEditingType constants declared in the Microsoft Office type library.

Example

This example changes all corner nodes to smooth curve nodes in the third shape in the active publication. The shape must be a freeform drawing.

VBA Copy code Copy code
Dim intNode As Integer

With ActiveDocument.Pages(1).Shapes(3).Nodes
 For intNode = 1 to .Count
 If .Item(intNode).EditingType = msoEditingCorner Then
 .SetEditingType Index:=intNode, _
 EditingType:=msoEditingSmooth
 End If
 Next
End With


Font.SetScriptName Method (Publisher)

 Copy code hover
[image]

Font.SetScriptName Method (Publisher)
Send feedback

Sets the name of the font script to use in a text range.

Syntax

expression .SetScriptName(Script, FontName)

expression A variable that represents a Font object.

Parameters

Name | Required/Optional | Data Type | Description
Script | Required | PbFontScriptType | The script name.
FontName | Required | String | The font name.

Remarks

The Script parameter can be one of the PbFontScriptType constants declared in the Microsoft Publisher type library.

Example

This example verifies that the default font script in use for the specified text range is Tahoma and, if not, sets it as the default font script.

VBA Copy code Copy code
Sub GetScript()
 With ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.Font
 If .GetScriptName(Script:=pbFontScriptDefault) <> "Tahoma" Then
 .SetScriptName Script:=pbFontScriptDefault, _
 FontName:="Tahoma"
 End If
 End With
End Sub


WebPageOptions.BackgroundSoundLoopForever Property (Publisher)

 Copy code hover
[image]

WebPageOptions.BackgroundSoundLoopForever Property (Publisher)
Send feedback

Returns a Boolean value that specifies whether the background sound attached to the Web page should be repeated infinitely. Read-only.

Syntax

expression .BackgroundSoundLoopForever

expression A variable that represents a WebPageOptions object.

Return Value

Boolean

Remarks

The SetBackgroundSoundRepeat method is used to specify whether the background sound should be repeated infinitely after the page is loaded. Until the SetBackgroundSoundRepeat method is used to specify whether the background sound should be played infinitely, BackgroundSoundLoopForever is False.

Example

The following example sets the background sound for page four of the active Web publication to a .wav file on the local computer. If BackgroundSoundLoopForever is False, the SetBackgroundSoundRepeat method is used to specify that the background sound should be repeated infinitely. The BackgroundSoundLoopForever property will now be True.

Copy code Copy code
Dim theWPO As WebPageOptions

Set theWPO = ActiveDocument.Pages(4).WebPageOptions

With theWPO
 .BackgroundSound = "C:\CompanySounds\corporate_jingle.wav"
 If .BackgroundSoundLoopForever = False Then
 .SetBackgroundSoundRepeat RepeatForever:=True
 End If
End With


Font.BoldBi Property (Publisher)

 Copy code hover
[image]

Font.BoldBi Property (Publisher)
Send feedback

Returns or sets an MsoTriState constant indicating whether the font is bold; used with text in a right-to-left language. Read/write.

Syntax

expression .BoldBi

expression A variable that represents a Font object.

Return Value

MsoTriState

Remarks

The BoldBi property value can be one of the following MsoTriState constants declared in the Microsoft Office type library.

Constant | Description
msoFalse | None of the characters in the range are formatted as bold.
msoTriStateMixed | Return value indicating that the range contains some text formatted as bold and some text not formatted as bold.
msoTriStateToggle | Set value that switches between msoTrue and msoFalse.
msoTrue | All characters in the range are formatted as bold.

Example

This example tests the text in the first story and displays one of two possible messages depending on whether the text is right-to-left formatted and whether its font is bold. For this example to execute properly, there must be at least one story with text in the active publication.

Copy code Copy code
Sub BoldRtoL()

 Dim stf As Font

 Set stf = Application.ActiveDocument.Stories(1).TextRange.Font

 With stf
 If .BoldBi = msoTrue Then
 MsgBox "This story is right-to-left and is bold."
 Else
 MsgBox "This story is either not right-to-left" & _
 " or it is not bold."
 End If
 End With

End Sub


TextRange.BoundTop Property (Publisher)

 Copy code hover
[image]

TextRange.BoundTop Property (Publisher)
Send feedback

Returns a Single indicating the distance, in points, from the top edge of the topmost page to the top edge of the bounding box for the specified text range. Read-only.

Syntax

expression .BoundTop

expression A variable that represents a TextRange object.

Return Value

Single

Example

The following example displays the position, width, and height of the bounding box surrounding the text in the first shape on page one of the active publication.

Copy code Copy code
Dim rngText As TextRange
Dim strMessage As String

Set rngText = ActiveDocument.Pages(1) _
 .Shapes(1).TextFrame.TextRange

With rngText
 strMessage = "Text frame information" & vbCrLf _
 & " Distance from left edge of page: " _
 & .BoundLeft & " points" & vbCrLf _
 & " Distance from top edge of page: " _
 & .BoundTop & " points" & vbCrLf _
 & " Width: " & .BoundWidth & " points" & vbCrLf _
 & " Height: " & .BoundHeight & " points"
End With

MsgBox strMessage


Application.Application Property (Publisher)

 Copy code hover
[image]

Application.Application Property (Publisher)
See also Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents an Application object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next

See also

Concepts

Application Object

Other resources

Application Object Members


Hyperlinks.Add Method (Publisher)

 Copy code hover
[image]

Hyperlinks.Add Method (Publisher)
Send feedback

Adds a new Hyperlink object to the specified Hyperlinks collection and returns the new Hyperlink object.

Syntax

expression .Add(Text, Address, RelativePage, PageID, TextToDisplay)

expression A variable that represents a Hyperlinks object.

Parameters

Name | Required/Optional | Data Type | Description
Text | Required | TextRange | TextRange object. The text range to be converted into a hyperlink.
Address | Optional | String | The address of the new hyperlink. If RelativePage is pbHlinkTargetTypeURL (default) or pbHlinkTargetTypeEmail, Address must be specified or an error occurs.
RelativePage | Optional | PbHlinkTargetType | The type of hyperlink to add.
PageID | Optional | Long | The page ID of the destination page for the new hyperlink. If RelativePage is pbHlinkTargetTypePageID, PageID must be specified or an error occurs. The page ID corresponds to the PageID property of the destination page.
TextToDisplay | Optional | String | The display text of the new hyperlink. If specified, TextToDisplay replaces the text range specified by the Text argument.

Return Value

Hyperlink

Remarks

RelativePage can be one of these PbHlinkTargetType constants. The default is pbHlinkTargetTypeURL.

pbHlinkTargetTypeEmail

pbHlinkTargetTypeFirstPage

pbHlinkTargetTypeLastPage

pbHlinkTargetTypeNextPage

pbHlinkTargetTypePageID

pbHlinkTargetTypePreviousPage

pbHlinkTargetTypeURL

Example

The following example adds hyperlinks to shape one and shape two on page one of the active publication. The first hyperlink points to an external Web site, and the second link points to the fourth page in the publication. Shape one and shape two must be text boxes and there must be at least four pages in the publication for this example to work.

VBA Copy code Copy code
Dim hypNew As Hyperlink
Dim lngPageID As Long
Dim strPage As String

With ActiveDocument.Pages(1).Shapes(1).TextFrame
 Set hypNew = .TextRange.Hyperlinks.Add(Text:=.TextRange, _
 Address:="http://www.tailspintoys.com/", _
 TextToDisplay:="Tailspin")
End With

lngPageID = ActiveDocument.Pages(4).PageID
strPage = "Go to page " _
 & Str(ActiveDocument.Pages(4).PageNumber)

With ActiveDocument.Pages(1).Shapes(2).TextFrame
 Set hypNew = .TextRange.Hyperlinks.Add(Text:=.TextRange, _
 RelativePage:=pbHlinkTargetTypePageID, _
 PageID:=lngPageID, _
 TextToDisplay:=strPage)
End With


WebNavigationBarHyperlinks.Item Method (Publisher)

 Copy code hover
[image]

WebNavigationBarHyperlinks.Item Method (Publisher)
Send feedback

Returns an individual object in a specified collection.

Syntax

expression .Item(Index)

expression A variable that represents a WebNavigationBarHyperlinks object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | Variant. The number or name of the field or list box item to return.

Return Value

Hyperlink


Documents Properties (Publisher)

 Copy code hover
[image]

Documents Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Item | Returns an individual object from a specified collection. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


BuildingBlocks.Application Property (Publisher)

 Copy code hover
[image]

BuildingBlocks.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Microsoft Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Syntax

expression .Application

expression A variable that represents a BuildingBlocks object.


Font.AutomaticPairKerningThreshold Property (Publisher)

 Copy code hover
[image]

Font.AutomaticPairKerningThreshold Property (Publisher)
Send feedback

Returns or sets a Variant value that represents the point size above which kerning is automatically adjusted for characters in the specified text range. Read/write.

Syntax

expression .AutomaticPairKerningThreshold

expression A variable that represents a Font object.

Return Value

Variant

Remarks

Valid range is 0.0 points to 999.5 points. Returns -2 if the value for characters in the text range is indeterminate. Setting this property to 0.0 disables automatic pair kerning on the range.

Example

This example sets the point size threshold to 12 points. All text in the second story above the threshold will implement auto kerning.

Copy code Copy code
Sub Threshold()

 Application.ActiveDocument.Stories(2).TextRange _
 .Font.AutomaticPairKerningThreshold = 12

End Sub


Shapes Methods (Publisher)

 Copy code hover
[image]

Shapes Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
AddBuildingBlock | Adds a BuildingBlock object and returns a Shape object on the page that represents the building block.
AddCallout | Adds a new Shape object representing a borderless line callout to the specified Shapes collection.
AddCatalogMergeArea | Adds a Shape object that represents the specified publication's catalog merge area.
AddCatalogMergeFieldToCanvas | Adds a catalog merge field of the specified type to the canvas. Returns nothing.
AddConnector | Adds a new Shape object representing a connector to the specified Shapes collection.
AddCurve | Adds a new Shape object representing a Bézier curve to the specified Shapes collection.
AddEmptyPictureFrame | Returns a Shape object that represents an empty picture frame inserted at the specified coordinates.
AddGroupWizard | Adds a Shape object representing a Design Gallery object to the publication.
AddLabel | Adds a new Shape object representing a text label to the specified Shapes collection.
AddLine | Adds a new Shape object representing a line to the specified Shapes collection.
AddOLEObject | Adds a new Shape object representing an OLE object to the specified Shapes collection.
AddPicture | Adds a new Shape object representing a picture to the specified Shapes collection.
AddPolyline | Adds a new Shape object representing an open polyline or a closed polygon to the specified Shapes collection.
AddShape | Adds a new Shape object representing an AutoShape to the specified Shapes collection.
AddTable | Adds a new Shape object representing a table to the specified Shapes collection.
AddTextbox | Adds a new Shape object representing a text box to the specified Shapes collection.
AddTextEffect | Adds a new Shape object representing a WordArt object to the specified Shapes collection.
AddWebControl | Adds a new Shape object representing a Web form control to the specified Shapes collection.
AddWebNavigationBar | Adds a Shape object of type pbWebNavigationBar to the current page of a publication.
AddWordArt | Returns a Shape object that represents the WordArt to be added to the publication.
BuildFreeform | Builds a freeform object. Returns a FreeformBuilder object that represents the freeform as it is being built.
FindShapeByWizardTag | Returns a ShapeRange object representing one or all of the shapes placed in a publication by a wizard and bearing the specified wizard tag.
Item | Returns an individual object in a specified collection.
Paste | Pastes the shapes or text on the Clipboard into the specified Shapes collection, at the top of the z-order. Each pasted object becomes a member of the specified Shapes collection. If the Clipboard contains a text range, the text will be pasted into a newly created TextFrame shape. Returns a ShapeRange object that represents the pasted objects.
Range | Returns a ShapeRange object that represents a subset of the shapes in a Shapes collection.
SelectAll | Selects all the shapes in the specified Shapes collection.


CaptionStyle Object (Publisher)

 Copy code hover
[image]

CaptionStyle Object (Publisher)
Send feedback

Represents a single caption style. The CaptionStyle object is a member of the CaptionStyles collection. The CaptionStyles collection represents all the 37 caption styles available in Microsoft Publisher 2010, although not necessarily in the current document.


Plate Object (Publisher)

 Copy code hover
[image]

Plate Object (Publisher)
Send feedback

Represents a single printer's plate. The Plate object is a member of the Plates collection.

Example

Use the Add method of the Plates collection to create a new plate. This example creates a new spot-color plate collection and adds a plate to it.

Copy code Copy code
Sub AddNewPlates()
 Dim plts As Plates
 Set plts = ActiveDocument.CreatePlateCollection(Mode:=pbColorModeSpot)
 plts.Add
 With plts(1)
 .Color.RGB = RGB(Red:=255, Green:=0, Blue:=0)
 .Luminance = 4
 End With
End Sub

Use the FindPlateByInkName method to return a specific plate by referencing its ink name. Process colors are assigned different index numbers in the Plates collection than in the PrintablePlates collection. Use the FindPlateByInkName method to insure the desired Plate or PrintablePlate object is accessed.


WrapFormat.DistanceRight Property (Publisher)

 Copy code hover
[image]

WrapFormat.DistanceRight Property (Publisher)
Send feedback

When the Type property of the WrapFormat object is set to pbWrapTypeSquare, returns or sets a Variant that represents the distance (in points) between the document text and the right edge of the specified shape. Read/write.

Syntax

expression .DistanceRight

expression A variable that represents a WrapFormat object.

Example

This example adds an oval to the active document and specifies that the document text wrap around the left and right sides of the square that circumscribes the oval. The example sets a 0.1-inch margin between the document text and the top, bottom, left side, and right side of the square.

Copy code Copy code
Sub AddNewShape()
 Dim shpOval As Shape

 Set shpOval = ActiveDocument.Pages(1).Shapes _
 .AddShape(Type:=msoShapeOval, Left:=36, _
 Top:=36, Width:=100, Height:=35)
 With shpOval.TextWrap
 .Type = pbWrapTypeSquare
 .Side = pbWrapSideBoth
 .DistanceAuto = msoFalse
 .DistanceTop = InchesToPoints(0.1)
 .DistanceBottom = InchesToPoints(0.1)
 .DistanceLeft = InchesToPoints(0.1)
 .DistanceRight = InchesToPoints(0.1)
 End With
End Sub


FillFormat.Transparency Property (Publisher)

 Copy code hover
[image]

FillFormat.Transparency Property (Publisher)
See also Send feedback

Returns or sets the degree of transparency of the specified fill for a shape as a value between 0.0 (opaque) and 1.0 (clear). Read/write.

Version Information

Version Added: Publisher 2013

Syntax

expression .Transparency

expression A variable that represents a FillFormat object.

Return value

Single

Remarks

The setting of the Transparency property corresponds to the setting of the Transparency control in the Publisher 2013 user interface.

The value of this property affects the appearance of solid-colored fills only. It has no effect on the appearance of patterned, gradient, picture, or textured fills.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


CaptionStyle.Application Property (Publisher)

 Copy code hover
[image]

CaptionStyle.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Microsoft Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.

Syntax

expression .Application

expression A variable that represents a CaptionStyle object.


Application.PathSeparator Property (Publisher)

 Copy code hover
[image]

Application.PathSeparator Property (Publisher)
See also Send feedback

Returns a String that represents the character used to separate folder names. Read-only.

Syntax

expression .PathSeparator

expression A variable that represents a Application object.

Return Value

String

Remarks

You can use PathSeparator to build Web addresses even though they contain forward slashes (/).

The FullName property returns the path and file name as a single string.

For worldwide compatibility, we recommend that you use this property when building paths, rather than referring explicitly to path separator characters in code (for example, "/").

Example

This example displays the path and file name of the active document.

VBA Copy code Copy code
Sub PathFileName()

 With Application
 MsgBox "The name of the active document: " & vbLf & _
 .Path & .PathSeparator & ActiveDocument.Name
 End With

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


TextFrame.HasText Property (Publisher)

 Copy code hover
[image]

TextFrame.HasText Property (Publisher)
Send feedback

Returns an MsoTriState constant indicating whether the specified shape has text associated with it. Read-only.

Syntax

expression .HasText

expression A variable that represents a TextFrame object.

Example

If shape two on the first page of the active publication contains text, this example resizes the shape to fit the text.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes(2).TextFrame
 If .HasText Then .AutoFitText = pbTextAutoFitBestFit
End With


WebOptions.OrganizeInFolder Property (Publisher)

 Copy code hover
[image]

WebOptions.OrganizeInFolder Property (Publisher)
Send feedback

Returns or sets a Boolean value that specifies whether a Web publication will be saved in a flat structure or hierarchical structure. If False, all files in the Web publication will be saved in a flat structure within the root folder. If True, the files will be saved in a hierarchical structure within the root folder. The default value is True. Read/write.

Syntax

expression .OrganizeInFolder

expression A variable that represents an WebOptions object.

Return Value

Boolean

Example

The following example specifies that all files in the Web publication should be saved in a flat structure within the root folder.

VBA Copy code Copy code
Dim theWO As WebOptions

Set theWO = Application.WebOptions

With theWO
 .OrganizeInFolder = False
End With


ParagraphFormat.LeftIndent Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.LeftIndent Property (Publisher)
Send feedback

Returns or sets a Variant that represents the left indent value (in points) for the specified paragraphs. Read/write.

Syntax

expression .LeftIndent

expression A variable that represents a ParagraphFormat object.

Return Value

Variant

Example

This example indents the paragraph at the cursor position 0.5 inch. This example assumes the cursor is in a text box.

Copy code Copy code
Sub IndentParagraph()
 Selection.TextRange.ParagraphFormat.LeftIndent = 36
End Sub


Shapes.Range Method (Publisher)

 Copy code hover
[image]

Shapes.Range Method (Publisher)
Send feedback

Returns a ShapeRange object that represents a subset of the shapes in a Shapes collection.

Syntax

expression .Range(Index)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual shapes that are to be included in the range. Can be an integer that specifies the index number of the shape, a string that specifies the name of the shape, or an array that contains either integers or strings. If Index is omitted, the Range method returns all the objects in the specified collection.

Return Value

ShapeRange

Example

To specify an array of integers or strings for Index, you can use the Array function. For example, the following instruction returns two shapes specified by name.

VBA Copy code Copy code
Dim arrShapes As Variant
Dim shpRange As ShapeRange

Set arrShapes = Array("Oval 4", "Rectangle 5")
Set shpRange = ActiveDocument.Pages(1) _
 .Shapes.Range(arrShapes)

This example sets the fill pattern for shapes one and three on the active publication.

Copy code Copy code
ActiveDocument.Pages(1).Shapes.Range(Array(1, 3)).Fill _
 .Patterned msoPatternHorizontalBrick
VBA Copy code Copy code

This example sets the fill pattern for the shapes named "Oval 4" and "Rectangle 5" on the first page.

Copy code Copy code
Dim arrShapes As Variant
Dim shpRange As ShapeRange

arrShapes = Array("Oval 4", "Rectangle 5")

Set shpRange = ActiveDocument.Pages(1).Shapes.Range(arrShapes)

shpRange.Fill.Patterned msoPatternHorizontalBrick

This example sets the fill pattern for all shapes on the first page.

Copy code Copy code
ActiveDocument.Pages(1).Shapes _
 .Range.Fill.Patterned msoPatternHorizontalBrick

This example sets the fill pattern for shape one on the first page.

Copy code Copy code
Dim shpRange As ShapeRange

Set shpRange = ActiveDocument.Pages(1).Shapes.Range(1)

shpRange.Fill.Patterned msoPatternHorizontalBrick

This example creates an array that contains all the AutoShapes on the first page, uses that array to define a shape range, and then distributes all the shapes in that range horizontally.

Copy code Copy code
Dim numShapes As Long
Dim numAutoShapes As Long
Dim autoShpArray As Variant
Dim intLoop As Integer
Dim shpRange As ShapeRange

With ActiveDocument.Pages(1).Shapes

 numShapes = .Count
 If numShapes > 1 Then

 numAutoShapes = 0
 ReDim autoShpArray(1 To numShapes)

 For intLoop = 1 To numShapes
 If .Item(intLoop).Type = msoAutoShape Then
 numAutoShapes = numAutoShapes + 1
 autoShpArray(numAutoShapes) = .Item(intLoop).Name
 End If
 Next

 If numAutoShapes > 1 Then
 ReDim Preserve autoShpArray(1 To numAutoShapes)
 Set shpRange = .Range(autoShpArray)
 shpRange.Distribute _
 DistributeCmd:=msoDistributeHorizontally, _
 RelativeTo:=False
 End If

 End If

End With


PictureFormat.CropLeft Property (Publisher)

 Copy code hover
[image]

PictureFormat.CropLeft Property (Publisher)
Send feedback

Returns or sets a Variant indicating the amount by which the left edge of a picture or OLE object is cropped. Read/write.

Syntax

expression .CropLeft

expression A variable that represents a PictureFormat object.

Return Value

Variant

Remarks

Numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

Negative values crop the bottom edge away from the center of the frame and positive values crop toward the right edge of the frame.

The valid range of crop values depends on the frame's position and size. For an unrotated frame, the lowest negative value allowed is the distance between the left edge of frame and the left edge of the scratch area. The highest positive value allowed is the current frame width.

Cropping is calculated relative to the original size of the picture. For example, if you insert a picture that is originally 100 points wide, rescale it so that it is 200 points wide, and then set the CropLeft property to 50, 100 points (not 50) will be cropped off the left of your picture.

Use the CropRight, CropTop, and CropBottom properties to crop other edges of a picture or OLE object.

Example

This example crops 20 points off the left of the third shape in the active publication. For the example to work, the shape must be either a picture or an OLE object.

Copy code Copy code
ActiveDocument.Pages(1).Shapes(3).PictureFormat _
 .CropLeft = 20

This example crops the percentage specified by the user off the left of the selected shape, regardless of whether the shape has been scaled. For the example to work, the selected shape must be either a picture or an OLE object.

Copy code Copy code
Dim sngPercent As Single
Dim shpCrop As Shape
Dim sngPoints As Single
Dim sngWidth As Single

sngPercent = InputBox("What percentage do you " & _
 "want to crop off the left of this picture?")

Set shpCrop = Selection.ShapeRange(1)
With shpCrop.Duplicate
 .ScaleWidth Factor:=1, _
 RelativeToOriginalSize:=True
 sngWidth = .Width
 .Delete
End With

sngPoints = sngWidth * sngPercent / 100

shpCrop.PictureFormat.CropLeft = sngPoints


Document.PrintOutEx Method (Publisher)

 Copy code hover
[image]

Document.PrintOutEx Method (Publisher)
Send feedback

Prints all or part of the specified publication.

Syntax

expression .PrintOut(From, To, PrintToFile, Copies, Collate, PrintStyle)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
From | Optional | Long | The starting page number.
To | Optional | Long | The ending page number.
PrintToFile | Optional | String | The path and file name of a document to be printed to a file.
Copies | Optional | Long | The number of copies to be printed.
Collate | Optional | Boolean | When printing multiple copies of a document, True to print all pages of the document before printing the next copy.
PrintStyle | Optional | PbPrintStyle | The print style to use. See Remarks for possible values.

Remarks

The PrintStyle parameter can be one of the PbPrintStyle constants declared in the Microsoft Publisher type library.

If PrintStyle is pbPrintStyleMultipleCopiesPerSheet or pbPrintStyleMultiplePagesPerSheet, Publisher ignores any value you pass for the Collate parameter.

Example

This example prints the active publication.

VBA Copy code Copy code
Sub PrintActivePublication()
 ThisDocument.PrintOutEx
End Sub


TextRange.ContainingObject Property (Publisher)

 Copy code hover
[image]

TextRange.ContainingObject Property (Publisher)
Send feedback

Returns an Object that represents the object that contains the text range. Read-only.

Syntax

expression .ContainingObject

expression A variable that represents a TextRange object.

Return Value

Object

Example

This example returns the name of the object containing the specified text range.

Copy code Copy code
Sub NameOfContainingObject()
 With ActiveDocument.Pages(1).Shapes(1).TextFrame _
 .TextRange.ContainingObject
 MsgBox The name of the object containing the text is " & .Name
 End With
End Sub


PageSizes Object (Publisher)

 Copy code hover
[image]

PageSizes Object (Publisher)
Send feedback

Represents the collection of all PageSize objects in the parent Document object, where each PageSize object represents one of the page sizes available in the current Microsoft Publisher document.

Version Information

Version Added: Publisher 2007

Remarks

The page sizes represented by the PageSizes collection correspond to the icons displayed under Blank Page Sizes in the Page Setup dialog box in the Publisher user interface.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the PageSizes collection to get all the page sizes available in the current document and print the list in the Immediate window.

VBA Copy code Copy code
Public Sub PageSizes_Example()

 Dim pubPageSizes As Publisher.PageSizes
 Dim pubPageSize As Publisher.PageSize

 Set pubPageSizes = ThisDocument.PageSetup.AvailablePageSizes
 For Each pubPageSize In pubPageSizes
 Debug.Print pubPageSize.Name
 Next

End Sub


WizardValues.Count Property (Publisher)

 Copy code hover
[image]

WizardValues.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a WizardValues object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


Plates.Count Property (Publisher)

 Copy code hover
[image]

Plates.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a Plates object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


CaptionStyle Members (Publisher)

 Copy code hover
[image]

CaptionStyle Members (Publisher)
Send feedback

Represents a single caption style. The CaptionStyle object is a member of the CaptionStyles collection. The CaptionStyles collection represents all the 37 caption styles available in Microsoft Publisher 2010, although not necessarily in the current document.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Microsoft Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. Read-only.
Name | A string that represents the name of the caption style. Read-only.
Parent | Returns the parent of the CaptionStyle object. Read-only.


MailMergeDataFields.Count Property (Publisher)

 Copy code hover
[image]

MailMergeDataFields.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a MailMergeDataFields object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


ColorFormat Properties (Publisher)

 Copy code hover
[image]

ColorFormat Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
BaseCMYK | Returns the base cyan-magenta-yellow-black (CMYK) color value of the parent ColorFormat object before any tinting or shading is applied to the color. Read-only.
BaseRGB | Returns or sets an MsoRGBType constant that represents the original RGB color format before color-changing properties, such as tinting and shading, are applied. Read/write.
CMYK | Returns a ColorCMYK object that represents CMYK color properties.
Ink | Returns or sets a Long indicating whether the specified color is a spot color, and if so, the spot plate to which it belongs. Valid values are pbInkNone (default; meaning that the color is not a spot color) or a number between 1 and n where n is the number of spot plates. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
RGB | Returns or sets an MsoRGBType that represents the red-green-blue (RGB) value of the specified color. Read/write.
SchemeColor | Specifies the color of the current color scheme. Read/write.
TintAndShade | Returns or sets a Single that represents the lightening or darkening of a specified shape's color. Read/write.
Transparency | Gets or sets the degree of transparency of the color represented by the parent ColorFormat object as a value between 0.0 (opaque) and 1.0 (clear). Read/write.
Type | Returns or sets a PbColorType constant that represents the shape color type. Read-only.


Page.PageIndex Property (Publisher)

 Copy code hover
[image]

Page.PageIndex Property (Publisher)
Send feedback

Gets the index of the page in the Pages collection of the active document. Read-only.

Syntax

expression .PageIndex

expression A variable that represents a Page object.

Remarks

A PageIndex property value is assigned to each page when it is added, and the value is incremented for each additional page. When pages are added or deleted, page index numbers are reassigned such that the first page is always 1 and the page index numbers always increment by 1. For example, in a publication with five pages, the page index numbers will be 1 through 5, regardless of the page number displayed on the pages themselves.

Example

The following example displays the PageIndex, PageNumber, and PageID properties for all the pages in the active publication.

VBA Copy code Copy code
Dim lngLoop As Long

With ActiveDocument.Pages
For lngLoop = 1 To .Count
With .Item(lngLoop)
Debug.Print "PageIndex = " & .PageIndex _
& " / PageNumber = " & .PageNumber _
& " / PageID = " & .PageID
End With
Next lngLoop
End With


Application Properties (Publisher)

 Copy code hover
[image]

Application Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
ActiveDocument | Returns a Document object that represents the active publication. If there are no documents open, an error occurs.
ActiveWindow | Returns a Window object that represents the window with the focus. Because Microsoft Publisher only has one window, there is only one Window object to return.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Assistance | Gets a reference to the Microsoft Office (MSO) IAssistance object, which provides a means for developers to create a customized Help experience for users within Microsoft Office. Read-only.
AutomationSecurity | Specifies the security mode that Microsoft Publisher uses when programmatically opening files. Read/write.
Build | Returns a Long that represents the Microsoft Publisher build number. Read-only.
CaptionStyles | Returns a CaptionStyles collection that represents all the available caption styles. Read-only.
ColorSchemes | Returns a ColorSchemes collection that represents the color schemes available.
COMAddIns | Returns a COMAddIns collection that represents a reference to the Component Object Model (COM) add-ins currently loaded in Microsoft Publisher.
CommandBars | Sets or returns a CommandBars collection that represents the menu bar and all the toolbars in Microsoft Publisher.
Documents | Returns a Documents collection that represents all open publications. Read-only.
FileDialog | Returns a FileDialog object that represents a single instance of a file dialog box.
InsertBarcodeVisible | Determines whether Add a postal bar code is available under More Items on the Mail Merge and Catalog Merge task panes in the Microsoft Publisher user interface (UI); and whether Add postal bar codes is available under Prepare for Mailing on the Publisher Tasks task pane in the Publisher UI. Read/write.
InstalledPrinters | Returns an InstalledPrinters collection that represents the names of all the printers installed on the computer and to which Microsoft Publisher can print the publication. Read-only.
Language | Returns a Long that represents the language selected for the Microsoft Publisher user interface. Read-only.
Name | Returns a String value indicating the name of the specified object. Read-only.
OfficeDataSourceObject | Returns an OfficeDataSourceObject object representing the data source in a mail merge or catalog merge operation. Read-only.
Options | Returns an Options object that represents application settings you can set in Microsoft Publisher.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Path | Returns a String indicating the full path to the file of the saved active publication, not including the last separator or file name.
PathSeparator | Returns a String that represents the character used to separate folder names. Read-only.
PrintPreview | True to display in Print Preview the publication in the current view. Read/write Boolean.
ProductCode | Returns a String indicating the Microsoft Publisher globally unique identifier (GUID). Read-only.
ScreenUpdating | Returns or sets a Boolean indicating whether Microsoft Publisher refreshes the screen display during run time; True to refresh the screen display. Read/write.
Selection | Returns a Selection object that represents a selected range or the cursor.
ShowFollowUpCustom | Gets or sets the string, if any, that appears as the fourth item under Prepare to follow-up on this mailing on the third Mail Merge task pane in the Microsoft Publisher user interface. Read/write.
SnapToGuides | True for Microsoft Publisher to use the guides to align objects on a page in a publication. Read/write Boolean.
SnapToObjects | True for Microsoft Publisher to use objects on a page to line up other objects. Read/write Boolean.
TemplateFolderPath | Returns a String that represents the location where Microsoft Publisher templates are stored. Read-only.
ValidateAddressVisible | Determines whether Validate addresses is available under Refine recipients in the Mail Merge Recipients dialog box in the Microsoft Publisher user interface (UI); and whether Validate addresses is available under Prepare for Mailing on the Publisher Tasks task pane in the Publisher UI. Read/write.
Version | Returns a String indicating the version number of the currently-installed copy of Microsoft Publisher. Read-only.
WebOptions | Returns a WebOptions object, which represents the properties of Web publications. Read-only.
WizardCatalogVisible | Returns or sets a Boolean indicating whether the Wizard Catalog is visible. Read/write.


GlowFormat.Visible Property (Publisher)

 Copy code hover
[image]

GlowFormat.Visible Property (Publisher)
See also Send feedback

True if the specified object or the formatting applied to it is visible. Read/write MsoTriState.

Version Information

Version Added: Publisher 2013

Syntax

expression .Visible

expression A variable that represents a GlowFormat object.

Return value

MsoTriState

Remarks

For any object, some methods and properties may be unavailable if the Visible property is False.

See also

Other resources

GlowFormat Object
GlowFormat Object Members


MailMergeDataField.Index Property (Publisher)

 Copy code hover
[image]

MailMergeDataField.Index Property (Publisher)
Send feedback

Returns a Long that represents the position of a particular item in a specified collection. .

Syntax

expression .Index

expression A variable that represents a MailMergeDataField object.

Example

The following example loops through the MailMergeDataFields collection and displays the Index and Name properties for each field.

Copy code Copy code
Dim mmfLoop As MailMergeDataField

With ActiveDocument.MailMerge.DataSource
 If .DataFields.Count > 0 Then
 For Each mmfLoop In .DataFields
 Debug.Print "Field " & mmfLoop.Name _
 & " / Index " & mmfLoop.Index
 Next mmfLoop
 Else
 Debug.Print "No fields to report."
 End If
End With

The following example loops through the Plates collection and displays the Index and Name properties for each plate.

VBA Copy code Copy code
Dim plaLoop As Plate

If ActiveDocument.Plates.Count > 0 Then
 For Each plaLoop In ActiveDocument.Plates
 Debug.Print "Plate " & plaLoop.Name _
 & " / Index " & plaLoop.Index
 Next plaLoop
Else
 Debug.Print "No plates to report."
End If


TextRange.InsertPageNumber Method (Publisher)

 Copy code hover
[image]

TextRange.InsertPageNumber Method (Publisher)
Send feedback

Returns a TextRange object that represents a page number field in a publication.

Syntax

expression .InsertPageNumber(Type)

expression A variable that represents a TextRange object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Optional | PbPageNumberType | Specifies whether the page number is the current page number or the next or previous page number of a linked text box.

Return Value

TextRange

Remarks

Type can be one of these PbPageNumberType constants.

Constant | Description
pbPageNumberCurrent | The default.
pbPageNumberNextInStory | Inserts the page number of the next linked text box.
pbPageNumberPreviousInStory | Inserts the page number of the previous linked text box.

Example

This example inserts a page number field in a shape on the master page so that the current page number appears at the top of each page.

VBA Copy code Copy code
Sub PageNumberShape()
 With ActiveDocument.MasterPages(1).Shapes _
 .AddShape(Type:=msoShape5pointStar, Left:=36, _
 Top:=36, Width:=50, Height:=50)
 With .TextFrame.TextRange
 .InsertPageNumber
 .ParagraphFormat.Alignment = pbParagraphAlignmentCenter
 End With
 .Fill.ForeColor.RGB = RGB(Red:=125, Green:=125, Blue:=255)
 End With
End Sub


PictureFormat.Contrast Property (Publisher)

 Copy code hover
[image]

PictureFormat.Contrast Property (Publisher)
Send feedback

Returns or sets a Single indicating the contrast for the specified picture or OLE object. The value for this property must be a number from 0.0 (the least contrast) to 1.0 (the greatest contrast). Read/write.

Syntax

expression .Contrast

expression A variable that represents a PictureFormat object.

Return Value

Single

Remarks

Use the IncrementContrast method to incrementally adjust the contrast from its current level.

Example

This example sets the contrast for the first shape in the active publication. The shape must be either a picture or an OLE object.

Copy code Copy code
ActiveDocument.Pages(1).Shapes(1).PictureFormat _
 .Contrast = 0.8


ShapeNodes.SetEditingType Method (Publisher)

 Copy code hover
[image]

ShapeNodes.SetEditingType Method (Publisher)
Send feedback

Sets the editing type of the specified node. If the node is a control point for a curved segment, this method sets the editing type of the node adjacent to it that joins two segments. Depending on the editing type, this method may affect the position of adjacent nodes.

Syntax

expression .SetEditingType(Index, EditingType)

expression A variable that represents a ShapeNodes object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The node whose editing type is to be set. Must be a number from 1 to the number of nodes in the specified shape; otherwise, an error occurs.
EditingType | Required | MsoEditingType | The editing property of the node.

Remarks

The EditingType parameter can be one of the MsoEditingType constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoEditingAuto | Changes the node to a type appropriate to the segments being connected.
msoEditingCorner | Changes the node to a corner node.
msoEditingSmooth | Changes the node to a smooth curve node..
msoEditingSymmetric | Changes the node to a symmetric curve node.

Example

This example changes all corner nodes to smooth nodes in the third shape of the active publication. The shape must be a freeform drawing.

VBA Copy code Copy code
Dim intNode As Integer

With ActiveDocument.Pages(1).Shapes(3).Nodes
 For intNode = 1 to .Count
 If .Item(intNode).EditingType = msoEditingCorner Then
 .SetEditingType _
 Index:=intNode, EditingType:=msoEditingSmooth
 End If
 Next intNode
End With


Fields.Application Property (Publisher)

 Copy code hover
[image]

Fields.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a Fields object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Shape.Glow Property (Publisher)

 Copy code hover
[image]

Shape.Glow Property (Publisher)
See also Send feedback

Returns a GlowFormat object that represents the glow formatting for a shape. Read-only.

Version Information

Version Added: Publisher 2013

Syntax

expression .Glow

expression A variable that represents a Shape object.

Return value

GLOWFORMAT

See also

Other resources

Shape Object
Shape Object Members


ShapeNodes Object (Publisher)

 Copy code hover
[image]

ShapeNodes Object (Publisher)
Send feedback

A collection of all the ShapeNode objects in the specified freeform. Each ShapeNode object represents either a node between segments in a freeform or a control point for a curved segment of a freeform. You can create a freeform manually or by using the BuildFreeform and ConvertToShape methods.

Example

Use the Nodes property to return a ShapeNodes collection. The following example deletes node four in shape three on the active document. For this example to work, shape three must be a freeform with at least four nodes.

Copy code Copy code
Sub DeleteShapeNode()
 ActiveDocument.Pages(1).Shapes(3).Nodes.Delete Index:=4
End Sub

Use the Insert method to create a new node and add it to the ShapeNodes collection. The following example adds a smooth node with a curved segment after node four in shape three on the active document. For this example to work, shape three must e a freeform with at least four nodes.

Copy code Copy code
Sub AddCurvedSmoothSegment()
 ActiveDocument.Pages(1).Shapes(3).Nodes.Insert _
 Index:=4, SegmentType:=msoSegmentCurve, _
 EditingType:=msoEditingSmooth, X1:=210, Y1:=100
End Sub

Use Nodes(index), where index is the node index number, to return a single ShapeNode object. If node one in shape three on the active document is a corner point, the following example makes it a smooth point. For this example to work, shape three must be a freeform.

Copy code Copy code
Sub SetPointType()
 With ActiveDocument.Pages(1).Shapes(3)
 If .Nodes(1).EditingType = msoEditingCorner Then
 .Nodes.SetEditingType Index:=1, EditingType:=msoEditingSmooth
 End If
 End With
End Sub


Story Properties (Publisher)

 Copy code hover
[image]

Story Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
HasTable | Returns msoTrue if the shape represents a TableFrame object or msoFalse if the shape represents any other object type. Read-only.
HasTextFrame | Indicates whether the specified shape has a TextFrame object associated with it. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Table | Returns a Table object that represents a table in Microsoft Publisher.
TextFrame | Returns a TextFrame object that represents the text in a shape and the properties that control the margins and orientation of the text.
TextRange | Returns a TextRange object that represents the text that is attached to a shape and properties and methods for manipulating the text.
Type | Specifies the type of story. Read-only.


Page.Master Property (Publisher)

 Copy code hover
[image]

Page.Master Property (Publisher)
Send feedback

Sets or returns a Page object that represents the master page properties for the specified page.

Syntax

expression .Master

expression A variable that represents a Page object.

Return Value

Page

Remarks

Master pages do not have a Master property. Any attempt to access the Master property of a master page will result in a run-time error.

Example

This example adds a shape to the master page for the first page in the active publication.

VBA Copy code Copy code
Sub AddNewMasterPageShape()
 With ActiveDocument.Pages(1).Master.Shapes.AddShape _
 (Type:=msoShape5pointStar, Left:=512, _
 Top:=50, Width:=50, Height:=50)
 .Fill.ForeColor.CMYK.SetCMYK Cyan:=255, _
 Magenta:=255, Yellow:=0, Black:=0
 End With
End Sub

The Master property can also be used to apply a master page to a page in a publication. The following example sets the master page of the first page of a publication to the master page of the second page in the publication. This example assumes that there are at least two pages and two master pages in the document.

Copy code Copy code
ActiveDocument.Pages(1).Master = _
 ActiveDocument.Pages(2).Master


ShapeRange.Item Method (Publisher)

 Copy code hover
[image]

ShapeRange.Item Method (Publisher)
Send feedback

Returns an individual object in a specified collection.

Syntax

expression .Item(Index)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The number or name of the field or list box item to return.

Return Value

Shape

Example

This example returns the first shape inside a grouped shape.

VBA Copy code Copy code
Dim shpTemp As Shape

Set shpTemp = ActiveDocument.Pages(Index:=1) _
 .Shapes(1).GroupItems.Item(Index:=1)


ColorCMYK.Black Property (Publisher)

 Copy code hover
[image]

ColorCMYK.Black Property (Publisher)
Send feedback

Sets or returns a Long that represents the black component of a CMYK color. Value can be any number between 0 and 255. Read/write.

Syntax

expression .Black

expression A variable that represents a ColorCMYK object.

Return Value

Long

Example

This example creates two new shapes and then sets the CMYK fill color for one shape and sets the CMYK values of the second shape to the same CMYK values.

Copy code Copy code
Sub ReturnAndSetCMYK()
 Dim lngCyan As Long
 Dim lngMagenta As Long
 Dim lngYellow As Long
 Dim lngBlack As Long
 Dim shpHeart As Shape
 Dim shpStar As Shape

 Set shpHeart = ActiveDocument.Pages(1).Shapes.AddShape _
 (Type:=msoShapeHeart, Left:=100, _
 Top:=100, Width:=100, Height:=100)
 Set shpStar = ActiveDocument.Pages(1).Shapes.AddShape _
 (Type:=msoShape5pointStar, Left:=200, _
 Top:=100, Width:=150, Height:=150)

 With shpHeart.Fill.ForeColor.CMYK
 .SetCMYK 10, 80, 200, 30
 lngCyan = .Cyan
 lngMagenta = .Magenta
 lngYellow = .Yellow
 lngBlack = .Black
 End With

 'Sets new shape to current shape's CMYK colors
 shpStar.Fill.ForeColor.CMYK.SetCMYK _
 Cyan:=lngCyan, Magenta:=lngMagenta, _
 Yellow:=lngYellow, Black:=lngBlack
End Sub


Cell.MarginTop Property (Publisher)

 Copy code hover
[image]

Cell.MarginTop Property (Publisher)
Send feedback

Returns or sets a Variant that represents the amount of space (in points) between the text and the top edge of a cell, text frame, or page. Read/write.

Syntax

expression .MarginTop

expression A variable that represents a Cell object.

Example

This example sets the margins of the active publication to two inches.

Copy code Copy code
Sub SetPageMargins()

 With ActiveDocument.LayoutGuides
 .MarginTop = Application.InchesToPoints(Value:=2)
 .MarginBottom = Application.InchesToPoints(Value:=2)
 .MarginLeft = Application.InchesToPoints(Value:=2)
 .MarginRight = Application.InchesToPoints(Value:=2)
 End With

End Sub


Shape.AutoShapeType Property (Publisher)

 Copy code hover
[image]

Shape.AutoShapeType Property (Publisher)
Send feedback

Returns or sets an MsoAutoShapeType constant that specifies a Shape object's AutoShape type.

Syntax

expression .AutoShapeType

expression A variable that represents a Shape object.

Remarks

The AutoShapeType property value can be one of the MsoAutoShapeType constants declared in the Microsoft Office type library.

AutoShapes correspond to Shape objects, although the AutoShapeType property for non-Publisher shapes will also return a value. WordArt, OLE, Web Form control, table and picture frame objects should return msoShapeMixed as their AutoShapeType property value. Text frames should return msoShapeRectangle as their AutoShapeType property.

Example

This example converts the selected AutoShape object to a lightning bolt if it is a heart and to a 5-point star if it is not. For this example to execute properly, you must have an AutoShape object selected in the active publication.

VBA Copy code Copy code
Sub ShapeShift()

 Dim srShift As ShapeRange

 Set srShift = Application.ActiveDocument.Selection.ShapeRange
 If srShift.AutoShapeType = msoShapeHeart Then
 srShift.AutoShapeType = msoShapeLightningBolt
 Else
 srShift.AutoShapeType = msoShape5pointStar
 End If

End Sub


Tag Object (Publisher)

 Copy code hover
[image]

Tag Object (Publisher)
Send feedback

Represents a tag or a custom property that you can create for a shape, shape range, page, or publication. Each Tag object contains the name of a custom property and a value for that property. Tag objects are members of the Tags collection. Create a tag when you want to be able to selectively work with specific members of a collection, based on an attribute that isn't already represented by a built-in property.

Example

Use the Item method of the Tags collection to return a Tag object. This example fills all shapes on the first page of the active publication if the shape's first tag has a value of Oval.

Copy code Copy code
Sub FormatTaggedShapes()
 Dim shp As Shape
 With ActiveDocument.Pages(1)
 For Each shp In .Shapes
 If shp.Tags.Count > 0 Then
 If shp.Tags.Item(1).Value = "Oval" Then
 shp.Fill.ForeColor.RGB = RGB(Red:=255, Green:=0, Blue:=0)
 End If
 End If
 Next
 End With
End Sub

Use the Add method to add a Tag object. This example adds a tag to all oval shapes in the active publication.

Copy code Copy code
Sub TagShapes()
 Dim shp As Shape
 With ActiveDocument.Pages(1)
 For Each shp In .Shapes
 If InStr(1, shp.Name, "Oval") > 0 Then
 shp.Tags.Add Name:="Oval", Value:="This is an oval shape."
 End If
 Next shp
 End With
End Sub


TextFrame.Orientation Property (Publisher)

 Copy code hover
[image]

TextFrame.Orientation Property (Publisher)
Send feedback

Returns or sets a PbTextOrientation constant that represents how text flows in a text box. Read/write.

Syntax

expression .Orientation

expression A variable that represents a TextFrame object.

Return Value

PbTextOrientation

Remarks

The Orientation property value can be one of the PbTextOrientation constants declared in the Microsoft Publisher type library.

Example

This example sets the text orientation in the specified text box to vertical so that text flows from top to bottom. This assumes there is at least one shape on page one of the active publication.

VBA Copy code Copy code
Sub SetVerticalTextBox()
 ActiveDocument.Pages(1).Shapes(1).TextFrame _
 .Orientation = pbTextOrientationVerticalEastAsia
End Sub


TextEffectFormat.Alignment Property (Publisher)

 Copy code hover
[image]

TextEffectFormat.Alignment Property (Publisher)
Send feedback

Returns or sets a MsoTextEffectAlignment constant that represents the alignment for the specified text effect. Read/write.

Syntax

expression .Alignment

expression A variable that represents a TextEffectFormat object.

Remarks

The Alignment property value can be one of the MsoTextEffectAlignment constants declared in the Microsoft Office type library.


TextRange.InsertAfter Method (Publisher)

 Copy code hover
[image]

TextRange.InsertAfter Method (Publisher)
Send feedback

Returns a TextRange object that represents text appended to the end of a text range.

Syntax

expression .InsertAfter(NewText)

expression A variable that represents a TextRange object.

Parameters

Name | Required/Optional | Data Type | Description
NewText | Required | String | The text to be inserted.

Return Value

TextRange

Example

This example adds the Microsoft Publisher build number to the end of the first shape on the first page of the active publication. This example assumes the specified shape is a text frame and not another type of shape.

Copy code Copy code
Sub AppendText()
 With ActiveDocument.Pages(1).Shapes(1)
 .TextFrame.TextRange.InsertAfter _
 NewText:="Microsoft Publisher Build : " & Build
 End With
End Sub


Table.ApplyAutoFormat Method (Publisher)

 Copy code hover
[image]

Table.ApplyAutoFormat Method (Publisher)
Send feedback

Applies automatic built-in table formatting to a specified table.

Syntax

expression .ApplyAutoFormat(AutoFormat, TextFormatting, TextAlignment, Fill, Borders)

expression A variable that represents a Table object.

Parameters

Name | Required/Optional | Data Type | Description
AutoFormat | Required | PbTableAutoFormatType | The type of automatic formatting to apply to the specified table.
TextFormatting | Optional | Boolean | True to apply font formatting to the text in the table. Default value is True.
TextAlignment | Optional | Boolean | True to apply text alignment to the text in the table. Default value is True.
Fill | Optional | Boolean | True to apply fill formatting to cells in the table. Default value is True.
Borders | Optional | Boolean | True to apply borders to cells in the table. Default value is True.

Remarks

The AutoFormat parameter can be one of the PbTableAutoFormatType constants declared in the Microsoft Publisher type library.

Example

This example applies the checkbook register automatic formatting, with fill and borders, to the specified table.

VBA Copy code Copy code
Sub ApplyAutomaticTableFormatting()
 ActiveDocument.Pages(1).Shapes(1).Table.ApplyAutoFormat _
 AutoFormat:=pbTableAutoFormatCheckbookRegister, _
 Borders:=False
End Sub


OLEFormat Properties (Publisher)

 Copy code hover
[image]

OLEFormat Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Object | Returns an Object that represents the specified OLE object's top-level interface. This property allows you to access the properties and methods of an ActiveX control or the application in which an OLE object was created. The OLE object must support OLE Automation for this property to work. Read-only.
ObjectVerbs | Returns an ObjectVerbs collection that contains all the OLE verbs for the specified OLE object. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
ProgId | Returns a String that represents the programmatic identifier (ProgID) for the specified OLE object. Read-only.


Cell.BorderLeft Property (Publisher)

 Copy code hover
[image]

Cell.BorderLeft Property (Publisher)
Send feedback

Returns a CellBorder object that represents the left border for a specified table cell.

Syntax

expression .BorderLeft

expression A variable that represents a Cell object.

Return Value

CellBorder

Example

This example creates a checkerboard design using borders and a fill color with an existing table. This assumes the first shape on page two is a table and not another type of shape and that the table has an uneven number of columns.

Copy code Copy code
Sub FillCellsByRow()
 Dim shpTable As Shape
 Dim rowTable As Row
 Dim celTable As Cell
 Dim intCell As Integer

 intCell = 1

 Set shpTable = ActiveDocument.Pages(2).Shapes(1)
 For Each rowTable In shpTable.Table.Rows
 For Each celTable In rowTable.Cells
 With celTable
 With .BorderBottom
 .Weight = 2
 .Color.RGB = RGB(Red:=0, Green:=0, Blue:=0)
 End With
 With .BorderTop
 .Weight = 2
 .Color.RGB = RGB(Red:=0, Green:=0, Blue:=0)
 End With
 With .BorderLeft
 .Weight = 2
 .Color.RGB = RGB(Red:=0, Green:=0, Blue:=0)
 End With
 With .BorderRight
 .Weight = 2
 .Color.RGB = RGB(Red:=0, Green:=0, Blue:=0)
 End With
 End With
 If intCell Mod 2 = 0 Then
 celTable.Fill.ForeColor.RGB = RGB _
 (Red:=180, Green:=180, Blue:=180)
 Else
 celTable.Fill.ForeColor.RGB = RGB _
 (Red:=255, Green:=255, Blue:=255)
 End If
 intCell = intCell + 1
 Next celTable
 Next rowTable

End Sub


Shapes.FindShapeByWizardTag Method (Publisher)

 Copy code hover
[image]

Shapes.FindShapeByWizardTag Method (Publisher)
Send feedback

Returns a ShapeRange object representing one or all of the shapes placed in a publication by a wizard and bearing the specified wizard tag.

Syntax

expression .FindShapeByWizardTag(WizardTag, Instance)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
WizardTag | Required | PbWizardTag | Specifies the wizard tag for which to search.
Instance | Optional | Long | Specifies which instance of a shape with the specified wizard tag is returned. For Instance equal to n, the nth instance of a shape with the specified wizard tag is returned. If no value for Instance is specified, all the shapes with the specified wizard tag are returned.

Return Value

ShapeRange

Remarks

The WizardTag parameter can be one of the PbWizardTag constants declared in the Microsoft Publisher type library.

Example

The following example finds the second instance of a shape with the wizard tag pbWizardDate and assigns it to a variable.

VBA Copy code Copy code
Dim shpWizardTag As Shape

Set shpWizardTag = ActiveDocument.FindShapeByWizardTag(WizardTag:=pbWizardDate, Instance:=2)


Section.PageNumberStart Property (Publisher)

 Copy code hover
[image]

Section.PageNumberStart Property (Publisher)
Send feedback

Sets or returns the page number that the specified section starts with. Read/write Long.

Syntax

expression .PageNumberStart

expression A variable that represents a Section object.

Return Value

Long

Example

The following example sets the starting page number for the first section of the active document to 45.

VBA Copy code Copy code
ActiveDocument.Sections(1).PageNumberStart = 45


ColorSchemes Object (Publisher)

 Copy code hover
[image]

ColorSchemes Object (Publisher)
Send feedback

A collection of all the ColorScheme objects in Microsoft Publisher. Each ColorScheme object represents a color scheme, which is a set of colors that are used in a publication.

Example

Use the Count property to return the number of color schemes available to Publisher. The following example displays the number of color schemes.

Copy code Copy code
Sub CountColorSchemes()
 MsgBox Application.ColorSchemes.Count
End Sub

Use the Item property to return a specific color scheme from the ColorSchemes collection. The Index argument of the Item property can be the number or name of the color scheme, or a PbColorScheme constant. The follow example sets the color scheme of the active publication to Wildflower.

Copy code Copy code
Sub SetColorScheme()
 ActiveDocument.ColorScheme _
 = ColorSchemes.Item(pbColorSchemeWildflower)
End Sub

Use the Name property to return a color scheme name. The following example lists in a text box all the color schemes available to Publisher.

Copy code Copy code
Sub ListColorShemes()

 Dim clrScheme As ColorScheme
 Dim strSchemes As String

 For Each clrScheme In Application.ColorSchemes
 strSchemes = strSchemes & clrScheme.Name & vbLf
 Next
 ActiveDocument.Pages(1).Shapes.AddTextbox( _
 Orientation:=pbTextOrientationHorizontal, _
 Left:=72, Top:=72, Width:=400, Height:=500).TextFrame _
 .TextRange.Text = strSchemes

End Sub


DropCap.FontName Property (Publisher)

 Copy code hover
[image]

DropCap.FontName Property (Publisher)
Send feedback

Sets or returns a String that represents the name of the font applied to a dropped capital letter or WordArt text effect. Read/write.

Syntax

expression .FontName

expression A variable that represents a DropCap object.


AdvancedPrintOptions.UseOnlyPublicationFonts Property (Publisher)

 Copy code hover
[image]

AdvancedPrintOptions.UseOnlyPublicationFonts Property (Publisher)
See also Send feedback

Returns or sets a Boolean that represents whether to only use publication fonts for printing the specified publication. True to print the specified publication using only fonts downloaded from your computer. Read/write. The default is True.

Syntax

expression .UseOnlyPublicationFonts

expression A variable that represents an AdvancedPrintOptions object.

Return Value

Boolean

Remarks

Publication fonts are fonts that are downloaded from your computer, as opposed to fonts residing at the printer or imagesetter.

Set this property to False to enable the printer to print the specified publication using its resident fonts (stored in ROM, RAM, or on a hard disk drive) that have the same name as the fonts downloaded from your computer.

Note Note

This may result in the printer substituting resident printer for fonts downloaded from your computer. This results in a slightly faster print time. However, if the resident fonts are not exactly identical to your computer fonts (even if they have the same name), this may cause your printed publication to look different than expected.

Setting this property to True ensures that the fonts used to print the publication are the same ones used to create it.

This property corresponds to the Fonts controls on the Graphics and Fonts tab of the Advanced Print Settings dialog box.

Example

The following example tests to determine if the active publication will be printed using only publication fonts. If it will not, it is set to use only publication fonts.

VBA Copy code Copy code
Sub PrintWithPublicationFontsOnly()
 With ActiveDocument.AdvancedPrintOptions
 .UseOnlyPublicationFonts = True
 End With
End Sub

See also

Concepts

AdvancedPrintOptions Object

Other resources

AdvancedPrintOptions Object Members


Welcome to the Publisher 2013 developer reference

 Copy code hover
[image]

Welcome to the Publisher 2013 developer reference
Send feedback

This reference contains conceptual overviews, programming tasks, samples, and references to guide you in developing solutions based on Publisher 2013.

We welcome your comments or questions about this content. You can send feedback to docthis@microsoft.com.

Initial publication: October 2012

This documentation contains the following sections:

  • Concepts: Provides important concepts for developing custom Publisher solutions.

  • Reference: Provides reference materials for the Publisher object model.

Additional resources

  • Publisher Developer Center

  • Microsoft Office Developer Center

  • Accessibility in Microsoft Products

  • Document Conventions

  • Microsoft Online Privacy Notice

  • Publisher 2013 developer reference copyright notice


Document.ShapesAdded Event (Publisher)

 Copy code hover
[image]

Document.ShapesAdded Event (Publisher)
Send feedback

Occurs when one or more new shapes are added to a publication. This event occurs whether shapes are added manually or programmatically.

Syntax

expression .ShapesAdded

expression A variable that represents a Document object.

Example

This example displays a message whenever a new shape is added to the active publication. For this example to work, you must place this code into the ThisDocument module.

Copy code Copy code
Private Sub PubDoc_ShapesAdded()
 MsgBox "You just added a new shape."
End Sub


ScratchArea Properties (Publisher)

 Copy code hover
[image]

ScratchArea Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Shapes | Returns a Shapes collection that represents all the Shape objects in the specified publication. This collection can contain drawings, shapes, pictures, OLE objects, ActiveX controls, text objects, and callouts.


Page.Header Property (Publisher)

 Copy code hover
[image]

Page.Header Property (Publisher)
Send feedback

Returns a HeaderFooter object representing the header of the specified Page object. Read-only.

Syntax

expression .Header

expression A variable that represents a Page object.

Return Value

HeaderFooter

Remarks

This property is only for master pages. A "This feature is only for master pages" error is returned if the header property is accessed from a Page object that is returned form the Pages collection. A new HeaderFooter object is created for the specified master page by accessing this property.

Example

The following example creates a HeaderFooter object and sets it to the header of the first master page.

Copy code Copy code
Dim objHeader As HeaderFooter
Set objHeader = ActiveDocument.MasterPages(1).Header

The HeaderFooter object returned by the Header property can be used to manipulate the header content. The following example sets some properties of the HeaderFooter object of the first master page.

Copy code Copy code
With ActiveDocument.masterPages(1)
 With .Header
 .TextRange.Text = "Windows" & Chr(13) & "Office" & Chr(13) & "Internet Explorer"
 With .TextRange.ParagraphFormat
 .SetListType Value:=pbListTypeBullet, BulletText:="*"
 .Alignment = pbParagraphAlignmentLeft
 End With
 End With
 With .Footer
 .TextRange.Hyperlinks.Add Text:=.TextRange, _
 Address:="http://www.tailspintoys.com", _
 TextToDisplay:="Tailspin"
 End With
End With


MailMergeFilters.Parent Property (Publisher)

 Copy code hover
[image]

MailMergeFilters.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a MailMergeFilters object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


FillFormat.GradientVariant Property (Publisher)

 Copy code hover
[image]

FillFormat.GradientVariant Property (Publisher)
Send feedback

Returns a Long indicating the gradient variant for the specified fill. Generally, values are integers from 1 to 4 for most gradient fills. If the gradient style is msoGradientFromTitle or msoGradientFromCenter, this property returns either 1 or 2. The values for this property correspond to the gradient variants (numbered from left to right and from top to bottom) on the Gradient tab in the Fill Effects dialog box. Read-only.

Syntax

expression .GradientVariant

expression A variable that represents a FillFormat object.

Return Value

Long

Remarks

Use the OneColorGradient , PresetGradient , or TwoColorGradient method to set the gradient variant for the fill.

Example

This example adds a rectangle to the active publication and sets its fill gradient variant to match that of the shape named rect1. For the example to work, rect1 must have a gradient fill.

Copy code Copy code
Dim intVariant As Integer

With ActiveDocument.Pages(1).Shapes
 ' Store gradient variant of rect1.
 intVariant = .Item("rect1").Fill.GradientVariant
 ' Add new rectangle.
 With .AddShape(Type:=msoShapeRectangle, _
 Left:=0, Top:=0, Width:=40, Height:=80).Fill
 ' Set color and gradient of new rectangle.
 .ForeColor.RGB = RGB(128, 0, 0)
 .OneColorGradient Style:=msoGradientHorizontal, _
 Variant:=intVariant, Degree:=1
 End With
End With


Printer.PaperOrientation Property (Publisher)

 Copy code hover
[image]

Printer.PaperOrientation Property (Publisher)
Send feedback

Gets or sets page orientation (landscape or portrait) for the printer. Read/write.

Version Information

Version Added: Publisher 2007

Syntax

expression .PaperOrientation

expression A variable that represents a Printer object.

Return Value

PbOrientationType

Remarks

Possible values for PaperOrientation are pbOrientationLandscape (2) and pbOrientationPortrait (1).

The PaperOrientation property setting corresponds to the Orientation setting on the Publication and Paper Settings tab of the Print Setup dialog box (File menu) in the Microsoft Publisher user interface.


MailMergeDataSource Properties (Publisher)

 Copy code hover
[image]

MailMergeDataSource Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
ActiveRecord | Returns or sets a Long that represents the active mail merge record. Read/write.
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
ConnectString | Returns a String that represents the connection to the specified mail merge data source. Read-only.
DataFields | Returns a MailMergeDataFields collection that represents the fields in the specified data source.
DataSources | Returns the MailMergeDataSources collection that includes the parent MailMergeDataSource object. Read-only.
EverValidated | Indicates whether the list of recipient addresses in the parent MailMergeDataSource object has ever been validated. Read/write.
Filters | Returns a MailMergeFilters object that represents filters applied to the mail merge or catalog merge data source.
FirstRecord | Returns or sets a Long that represents the number of the first record to be merged in a mail merge or catalog merge operation. Read/write.
Included | True if a record is included in a mail merge. Read/write Boolean.
InvalidAddress | True to mark a record in a mail merge data source if it contains invalid data. Read/write Boolean.
InvalidComments | If the InvalidAddress property is True, this property returns or sets a String that describes invalid data in a mail merge record. Read/write.
IsMaster | Indicates whether the parent MailMergeDataSource object is a master data source (a combination of all data sources connected to the current publication). Read-only.
LastRecord | Returns or sets a Long that represents the number of the last record to be merged in a mail merge or catalog merge operation. Read/write.
MappedDataFields | Returns a MailMergeMappedDataFields object that represents the mapped data fields available in Microsoft Publisher.
Name | Returns a String value indicating the name of the specified object. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
RecordCount | Returns a Long that represents the number of records in the data source. Read-only.
TableName | Returns a String that represents the name of the table within the data source file that contains the mail merge records. The returned value may be blank if the table name is unknown or not applicable to the current data source. Read-only.
Type | Returns a Long that represents the type of mail merge or catalog merge data source. Read-only.
ValidatedClean | Indicates whether all recipient addresses in the the parent MailMergeDataSource object were successfully validated, and whether any changes are made to the list since the last validation that require the list to be validated again. Read/write.


MailMergeDataSource.EverValidated Property (Publisher)

 Copy code hover
[image]

MailMergeDataSource.EverValidated Property (Publisher)
Send feedback

Indicates whether the list of recipient addresses in the parent MailMergeDataSource object has ever been validated. Read/write.

Version Information

Version Added: Publisher 2007

Syntax

expression .EverValidated

expression A variable that represents a MailMergeDataSource object.

Return Value

Boolean

Remarks

The initial value of EverValidated is False.

If you create an add-in for Microsoft Publisher that validates recipient addresses and maintains its own data sources, your add-in can set the EverValidated property value to True after a successful validation.

The value of the EverValidated property is saved in the Microsoft Publisher file and is accessible across multiple sessions of Publisher.


CellRange.Merge Method (Publisher)

 Copy code hover
[image]

CellRange.Merge Method (Publisher)
Send feedback

Merges the specified table cells with one another. The result is a single table cell.

Syntax

expression .Merge

expression A variable that represents a CellRange object.

Example

This example merges the first two cells in the first two rows of the specified table.

VBA Copy code Copy code
Sub MergeCells()
 ActiveDocument.Pages(1).Shapes(2).Table _
 .Cells(StartRow:=1, StartColumn:=1, _
 EndRow:=2, EndColumn:=2).Merge
End Sub


ShapeRange.ConnectionSiteCount Property (Publisher)

 Copy code hover
[image]

ShapeRange.ConnectionSiteCount Property (Publisher)
Send feedback

Returns a Long indicating the count of connection sites on the current Shape object. Read-only.

Syntax

expression .ConnectionSiteCount

expression A variable that represents a ShapeRange object.

Remarks

The number of connection sites varies depending on the shape geometry. Rectangular objects including tables and Web controls will most likely have four connection sites, one centered on each edge of the shape.

Example

This example adds two rectangles to the active publication and joins them with two connectors. The beginnings of both connectors attach to connection site one on the first rectangle; the ends of the connectors attach to the first and last connection sites of the second rectangle. Then it counts the number of connections on the first rectangle.

Copy code Copy code
Sub Connections()

 Dim shpNew As Shapes
 Dim shpFirstRect As Shape
 Dim shpSecondRect As Shape
 Dim intLastSite As Integer
 Dim intCount As Integer

 Set shpNew = Application.ActiveDocument _
 .MasterPages(Item:=1).Shapes
 Set shpFirstRect = shpNew.AddShape(Type:=msoShapeRectangle, _
 Left:=100, Top:=50, Width:=200, Height:=100)
 Set shpSecondRect = shpNew.AddShape(msoShapeRectangle, _
 Left:=300, Top:=300, Width:=200, Height:=100)
 varLastSite = shpSecondRect.ConnectionSiteCount

 ' Add the first connector from rectangle 1,
 ' site 1 to rectangle 2, site 1.
 With shpNew.AddConnector(Type:=msoConnectorCurve, _
 BeginX:=0, BeginY:=0, EndX:=100, EndY:=100) _
 .ConnectorFormat
 .BeginConnect ConnectedShape:=shpFirstRect, ConnectionSite:=1
 .EndConnect ConnectedShape:=shpSecondRect, ConnectionSite:=1
 End With

 ' Add the second connector from rectangle 1,
 ' site 1 to rectangle 2, site 2.
 With shpNew.AddConnector(Type:=msoConnectorCurve, _
 BeginX:=0, BeginY:=0, EndX:=100, EndY:=100) _
 .ConnectorFormat
 .BeginConnect ConnectedShape:=shpFirstRect, ConnectionSite:=1
 .EndConnect ConnectedShape:=shpSecondRect, _
 ConnectionSite:=intLastSite
 End With

 intCount = shpFirstRect.ConnectionSiteCount

End Sub


Section.Delete Method (Publisher)

 Copy code hover
[image]

Section.Delete Method (Publisher)
Send feedback

Deletes the specified object.

Syntax

expression .Delete

expression A variable that represents a Section object.

Remarks

A run-time error occurs if the specified object does not exist.


TextStyle.Parent Property (Publisher)

 Copy code hover
[image]

TextStyle.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a TextStyle object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Attachments.Item Property (Publisher)

 Copy code hover
[image]

Attachments.Item Property (Publisher)
See also Send feedback

Returns the Attachment object at the specified index position in the Attachments collection. Read-only. .

Version Information

Version Added: Publisher 2007

Syntax

expression .Item(Item)

expression A variable that represents an Attachments collection.

Parameters

Name | Required/Optional | Data Type | Description
Item | Required | Long | The index position of the attachment to be returned.

Return Value

Attachment

See also

Concepts

Attachments Collection

Other resources

Attachments Object Members


Font.StrikeThrough Property (Publisher)

 Copy code hover
[image]

Font.StrikeThrough Property (Publisher)
Send feedback

Returns or sets an MsoTriState constant that represents the state of the StrikeThrough property on the characters in a text range. Read/write.

Version Information

Version Added: Publisher 2010

Syntax

expression .StrikeThrough

expression A variable that represents a Font object.

Return Value

MsoTriState

Remarks

The StrikeThrough property value can be one of the following MsoTriState constants declared in the Microsoft Office type library.

Constant | Description
msoFalse | None of the characters in the range are formatted as strikethrough.
msoTriStateMixed | Return value indicating that the range contains some text formatted as strikethrough and some text not formatted as strikethrough.
msoTriStateToggle | Set value that switches between msoTrue and msoFalse.
msoTrue | All characters in the range are formatted as strikethrough.


WebHiddenFields.Item Method (Publisher)

 Copy code hover
[image]

WebHiddenFields.Item Method (Publisher)
Send feedback

Returns a String corresponding to the value of a hidden field in a Web form or a list item in a Web list box control.

Syntax

expression .Item(Index)

expression A variable that represents a WebHiddenFields object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The number or name of the field or list box item to return.

Return Value

String


View Methods (Publisher)

 Copy code hover
[image]

View Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
ScrollShapeIntoView | Scrolls the publication window so that the specified shape is displayed in the publication window or pane.
ZoomIn | Increases the magnification of the specified view.
ZoomOut | Decreases the magnification of the specified view.


Printer.PaperSize Property (Publisher)

 Copy code hover
[image]

Printer.PaperSize Property (Publisher)
Send feedback

Returns the paper size setting found on the Publication and Paper Settings tab in the Print Setup dialog box in the Microsoft Publisher user interface (File menu). Read-only.

Version Information

Version Added: Publisher 2007

Syntax

expression .PaperSize

expression A variable that represents a Printer object.

Return Value

String

Remarks

If you change the value of either the PaperHeight or PaperWidth property, the value of the PaperSize property changes to Current.


ShapeRange.AutoShapeType Property (Publisher)

 Copy code hover
[image]

ShapeRange.AutoShapeType Property (Publisher)
Send feedback

Returns or sets an MsoAutoShapeType constant that specifies a ShapeRange object's AutoShape type.

Syntax

expression .AutoShapeType

expression A variable that represents a ShapeRange object.

Remarks

The AutoShapeType property value can be one of the MsoAutoShapeType constants declared in the Microsoft Office type library.

AutoShapes correspond to Shape objects, although the AutoShapeType property for non-Publisher shapes will also return a value. WordArt, OLE, Web Form control, table and picture frame objects should return msoShapeMixed as their AutoShapeType property value. Text frames should return msoShapeRectangle as their AutoShapeType property value.

Example

This example converts the selected AutoShape object to a lightning bolt if it is a heart and to a 5-point star if it is not. For this example to execute properly, you must have an AutoShape object selected in the active publication.

VBA Copy code Copy code
Sub ShapeShift()

 Dim srShift As ShapeRange

 Set srShift = Application.ActiveDocument.Selection.ShapeRange
 If srShift.AutoShapeType = msoShapeHeart Then
 srShift.AutoShapeType = msoShapeLightningBolt
 Else
 srShift.AutoShapeType = msoShape5pointStar
 End If

End Sub


ParagraphFormat.ListBulletText Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.ListBulletText Property (Publisher)
Send feedback

Returns a String representing the list bullet text from the specified paragraphs. Read-only.

Syntax

expression .ListBulletText

expression A variable that represents a ParagraphFormat object.

Return Value

String

Remarks

The ListBulletText property is limited to one character.

This property is read-only. To set the ListBulletText property of a bulleted list, use the SetListType method.

Returns an "Access Denied" message if the list is not a bulleted list.

Example

This example tests to see if the list type is a bulleted list. If it is, a test is made to see that the list bullet text is set to "*". If it is not, the SetListType method is called and passed pbListTypeBullet as the pbListType parameter and "*" as the BulletText parameter.

Copy code Copy code
Dim objParaForm As ParagraphFormat

Set objParaForm = ActiveDocument.Pages(1).Shapes(1) _
.TextFrame.TextRange.ParagraphFormat

With objParaForm
 If .ListType = pbListTypeBullet Then
 If Not .ListBulletText = "*" Then
 .SetListType pbListTypeBullet, "*"
 End If
 End If
End With


BuildingBlocks.Item Property (Publisher)

 Copy code hover
[image]

BuildingBlocks.Item Property (Publisher)
Send feedback

Returns the specified BuildingBlock object from a BuildingBlocks collection. Read-only.

Syntax

expression .Item(Item)

expression A variable that represents a BuildingBlocks object.

Parameters

Name | Required/Optional | Data Type | Description
Item | Required | Long | The number of the building block object to return.


PbCellDiagonalType Enumeration (Publisher)

 Copy code hover
[image]

PbCellDiagonalType Enumeration (Publisher)
Send feedback

Represents a cell that is diagonally split.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbTableCellDiagonalDown | 2 | Diagonal Down
pbTableCellDiagonalMixed | -2 | Diagonal Mixed
pbTableCellDiagonalNone | 0 | Not split Diagonally
pbTableCellDiagonalUp | 1 | Diagonal Up


ShapeRange.Flip Method (Publisher)

 Copy code hover
[image]

ShapeRange.Flip Method (Publisher)
Send feedback

Flips the specified shape around its horizontal or vertical axis, or flips all the shapes in the specified shape range around their horizontal or vertical axes.

Syntax

expression .Flip(FlipCmd)

expression A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
FlipCmd | Required | MsoFlipCmd | Specifies whether the shape is flipped horizontally or vertically.

Remarks

The FlipCmd parameter can be one of the following MsoFlipCmd constants declared in the Microsoft Office type library.

msoFlipHorizontal

msoFlipVertical

Example

This example adds a triangle to the first page of the active publication, duplicates the triangle, and then flips the duplicate triangle vertically and makes it red.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes _
 .AddShape(Type:=msoShapeRightTriangle, _
 Left:=10, Top:=10, Width:=50, Height:=50) _
 .Duplicate
 .Fill.ForeColor.RGB = RGB(255, 0, 0)
 .Flip msoFlipVertical
End With


Plate.Delete Method (Publisher)

 Copy code hover
[image]

Plate.Delete Method (Publisher)
Send feedback

Deletes the specified plate.

Syntax

expression .Delete(PlateReplaceWith, ReplaceTint)

expression A variable that represents a Plate object.

Parameters

Name | Required/Optional | Data Type | Description
PlateReplaceWith | Optional | Variant | Plate. The plate with which to replace the deleted plate.
ReplaceTint | Optional | PbReplaceTint | How to replace tints.

Remarks

Returns "Permission Denied" if you attempt to delete the last plate in the Plates collection.

The ReplaceTint parameter can be one of the following pbReplaceTint constants.

pbReplaceTintKeepTints | Maintain the same tint percentage in the ink represented by the replacement plate as in the deleted plate. For example, replace a 100% tint of yellow with a 100% tint of blue.
pbReplaceTintMaintainLuminosity | Maintain the same lightness value in the ink represented by the replacement plate as in the deleted plate. For example, replace a 100% tint of yellow with an approximately 10% tint of blue.
pbReplaceTintUseDefault | Use the default.

If the pbReplaceTintMaintainLuminosity constant is specified, the percentage of replacment ink in each color is calculated based on the luminosity values of the inks represented by the deleted and replacement plates. Publisher performs the following calculation, where L1 is the deleted ink luminosity, and L2 is the replacement ink luminosity: (100-L1)/(100-L2).

For example, red ink has a luminosity of 30, and black has a luminosity of 0. Suppose you replaced the red ink plate in a publication with a black ink plate. If pbReplaceTintKeepTints is specified, Publisher performs the following calculation to determine the percentage of black ink for each red color: (100-30)/(100-0). A color that was 100% red would now be 70% black; a color that was 50% red would now be 35% black, and so on.

If the pbReplaceTintKeepTints constant is specified, the percentage of the replacement ink in each color is the same as the deleted color. For example, if red ink is replaced with black ink, 100% tint of red is replaced by 100% tint of black, 50% red with 50% black, and so on.

You cannot specify the pbReplaceTintMaintainLuminosity or pbReplaceTintUseDefault constants if the replacement plate represents an ink that has a higher luminosity (that is, is lighter) than the deleted plate. This is because the lighter ink can not be printed at more than 100%, so it will not be able to match the luminosity of the darker ink.

Example

The following example loops through the active publication's plates collection, determines which plates represent inks not used in the publication, and deletes them. This example assumes that at least one of the plates is in use (the Delete method returns "Permission Denied" if you attempt to delete the last plate in the collection.)

VBA Copy code Copy code
Sub DeleteUnusedInks()

Dim intCount As Integer

With ActiveDocument.Plates
 For intCount = .Count To 1 Step -1
 With .Item(intCount)
 If .InUse = False Then
 Debug.Print "Name: " & .Name
 .Delete
 End If
 End With
 Next
End With

End Sub


MailMergeMappedDataField Members (Publisher)

 Copy code hover
[image]

MailMergeMappedDataField Members (Publisher)
Send feedback

Represents a single mapped data field. The MailMergeMappedDataField object is a member of the MailMergeMappedDataFields collection. A mapped data field is a field contained within Microsoft Publisher that represents commonly used name or address information, such as First Name. If a data source contains a First Name field or a variation (such as First_Name, FirstName, First, or FName), the field in the data source will automatically map to the corresponding mapped data field. If a publication is to be merged with more than one data source, mapped data fields make it unnecessary to reenter the fields into the publication to agree with the field names in the database.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
DataFieldName | Returns or sets a String which represents the name of the field in the mail merge data source to which a mapped data field maps. An empty string is returned if the specified data field is not mapped to a mapped data field. Read/write.
Index | Returns a Long that represents the position of a particular item in a specified collection. .
Name | Returns a String value indicating the name of the specified object. Read-only.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
Value | Returns a String that represents the value of a mail merge data field record or a mapped data field. Read-only.


Shape.HasTextFrame Property (Publisher)

 Copy code hover
[image]

Shape.HasTextFrame Property (Publisher)
Send feedback

Returns an MsoTriState constant if the specified shape has a TextFrame object associated with it. Read-only.

Syntax

expression .HasTextFrame

expression A variable that represents a Shape object.

Remarks

If the HasTextFrame property is true, clients must check the value of the HasText property of the TextFrame object to determine if there is any text on the shape.

The HasTextFrame property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

Constant | Description
msoFalse | The specified shape does not have a TextFrame object associated with it.
msoTriStateMixed | Indicates a combination of msoTrue and msoFalse for the specified shape range.
msoTrue | The specified shape has a TextFrame object associated with it.

Example

This example tests all the shapes in the selection and if none have text frames associated with them, they are left aligned.

VBA Copy code Copy code
Sub MoveLeft()

 Dim shpAll As ShapeRange

 Set shpAll = Application.ActiveDocument.Selection.ShapeRange
 If shpAll.HasTextFrame = msoFalse Then
 shpAll.Align msoAlignLefts, msoTrue
 End If

End Sub


BorderArtFormat.Color Property (Publisher)

 Copy code hover
[image]

BorderArtFormat.Color Property (Publisher)
See also Send feedback

Returns a ColorFormat object representing the color information for the specified object.

Syntax

expression .Color

expression A variable that represents a BorderArtFormat object.

Example

This example tests the font color of the first story in the active document and tells the user if the font color is black or not.

Copy code Copy code
Sub FontColor()

 If Application.ActiveDocument.Stories(1) _
 .TextRange.Font.Color.RGB = RGB(Red:=0, Green:=0, Blue:=0) Then
 MsgBox "Your font color is black"
 Else
 MsgBox "Your font color is not black"
 End If

End Sub

See also

Concepts

BorderArtFormat Object

Other resources

BorderArtFormat Object Members


Table.Columns Property (Publisher)

 Copy code hover
[image]

Table.Columns Property (Publisher)
Send feedback

Returns a Columns collection that represents all the columns of the specified table.

Syntax

expression .Columns

expression A variable that represents a Table object.

Example

This example enters a bold number into each cell in the specified table. This example assumes the specified shape is a table and not another type of shape.

VBA Copy code Copy code
Sub CountCellsByColumn()
 Dim shpTable As Shape
 Dim colTable As Column
 Dim celTable As Cell
 Dim intCount As Integer

 intCount = 1

 Set shpTable = ActiveDocument.Pages(2).Shapes(1)

 'Loops through each column in the table
 For Each colTable In shpTable.Table.Columns

 'Loops through each cell in the column
 For Each celTable In colTable.Cells
 With celTable.Text
 .Text = intCount
 .ParagraphFormat.Alignment = _
 pbParagraphAlignmentCenter
 .Font.Bold = msoTrue
 intCount = intCount + 1
 End With
 Next celTable
 Next colTable

End Sub


ParagraphFormat.KeepWithNext Property (Publisher)

 Copy code hover
[image]

ParagraphFormat.KeepWithNext Property (Publisher)
Send feedback

Sets or returns an MsoTriState that indicates whether the following paragraph will remain in the same text box as the specified paragraph. Read/write.

Syntax

expression .KeepWithNext

expression A variable that represents a ParagraphFormat object.

Return Value

MsoTriState

Remarks

The purpose of keep with next is to prevent hanging headings in a document. To do, you may set this property to msoTrue for all headings.

The default setting for this property is msoFalse.

Example

This example sets the KeepWithNext property to msoTrue for the specified ParagraphFormat object.

VBA Copy code Copy code
Dim objParaForm As ParagraphFormat
Set objParaForm = ActiveDocument.Pages(1).Shapes(1) _
 .TextFrame.TextRange.Paragraphs(1).ParagraphFormat
objParaForm.KeepWithNext = msoTrue


CellBorder.Weight Property (Publisher)

 Copy code hover
[image]

CellBorder.Weight Property (Publisher)
Send feedback

Returns or sets a Variant indicating the thickness of the specified line or cell border.

Syntax

expression .Weight

expression A variable that represents a CellBorder object.

Remarks

Return values are in points. When setting the property, numeric values are evaluated in points, and strings can be in any units supported by Publisher (for example, "2.5 in").

Example

This example adds a green dashed line, two points thick, to the active publication.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes _
 .AddLine(BeginX:=10, BeginY:=10, _
 EndX:=250, EndY:=250).Line
 .DashStyle = msoLineDashDotDot
 .ForeColor.RGB = RGB(0, 255, 255)
 .Weight = 2
End With


TabStops Object (Publisher)

 Copy code hover
[image]

TabStops Object (Publisher)
Send feedback

A collection of TabStop objects that represent the custom and default tabs for a paragraph or group of paragraphs.

Example

Use the Tabs property to return the TabStops collection. The following example clears all the custom tab stops from the first paragraph in the active publication.

Copy code Copy code
Sub ClearAllTabStops()
 ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange _
 .ParagraphFormat.Tabs.ClearAll
End Sub

The following example adds a tab stop positioned at 2.5 inches to the selected paragraphs and then displays the position of each item in the TabStops collection.

Copy code Copy code
Sub Tabs()
 Dim intTab As Integer
 Selection.TextRange.ParagraphFormat.Tabs _
 .Add Position:=InchesToPoints(2.5), _
 Alignment:=pbTabAlignmentLeading, Leader:=pbTabLeaderNone
 With Selection.TextRange.ParagraphFormat
 For intTab = 1 To .Tabs.Count
 MsgBox "Position = " & PointsToInches _
 (.Tabs(intTab).Position) & " inches"
 intTab = intTab + 1
 Next intTab
 End With
End Sub

Use the Add method to add a tab stop. The following example adds two tab stops to the selected paragraphs. The first tab stop is a left-aligned tab with a dotted tab leader positioned at 1 inch (72 points). The second tab stop is centered and is positioned at 2 inches.

Copy code Copy code
Sub AddNewTabs()
 With Selection.TextRange.ParagraphFormat.Tabs
 .Add Position:=InchesToPoints(1), _
 Leader:=pbTabLeaderDot, Alignment:=pbTabAlignmentLeading
 .Add Position:=InchesToPoints(2), _
 Leader:=pbTabLeaderNone, Alignment:=pbTabAlignmentCenter
 End With
End Sub

Use Tabs(index), where index is the location of the tab stop (in points) or the index number, to return a single TabStop object. Tab stops are indexed numerically from left to right along the ruler. The following example removes the first custom tab stop from the first paragraph in the active publication.

Copy code Copy code
Sub ClearTabStop()
 ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange _
 .ParagraphFormat.Tabs(1).Clear
End Sub

The following example changes the second tab in the selection to a right-aligned tab stop.

Copy code Copy code
Sub ChangeTabStop()
 Selection.TextRange.ParagraphFormat.Tabs(2) _
 .Alignment = pbTabAlignmentTrailing
End Sub


Attachments Members (Publisher)

 Copy code hover
[image]

Attachments Members (Publisher)
Send feedback

The collection of Attachment objects that represents all the attachments to a merged e-mail message.

Methods

Name | Description
Add | Adds an Attachment object to the Attachments collection of a Microsoft Publisher publication.
ClearAll | Clears (deletes) all the Attachment objects in the parent Attachments collection of an e-mail merge message.

Properties

Name | Description
Application | Returns an Application object that represents the creator of the parent Attachments collection. Read-only.
Count | Returns the number of Attachment objects in the Attachments collection of an EmailMergeEnvelope object. Read-only.
Item | Returns the Attachment object at the specified index position in the Attachments collection. Read-only. .
Parent | Returns the parent of the Attachments collection. Read-only.


Story.Parent Property (Publisher)

 Copy code hover
[image]

Story.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a Story object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


ShapeRange.Delete Method (Publisher)

 Copy code hover
[image]

ShapeRange.Delete Method (Publisher)
Send feedback

Deletes the specified object.

Syntax

expression .Delete

expression A variable that represents a ShapeRange object.

Remarks

A run-time error occurs if the specified object does not exist.


ShapeRange.ZOrderPosition Property (Publisher)

 Copy code hover
[image]

ShapeRange.ZOrderPosition Property (Publisher)
Send feedback

Returns a Long indicating the position of the specified shape or shape range in the z-order. Read-only.

Syntax

expression .ZOrderPosition

expression A variable that represents a ShapeRange object.

Remarks

A shape's position in the z-order corresponds to the shape's index number in the Shapes collection. For example, if there are four shapes on the page, the expression ActiveDocument.Pages(1).Shapes(1) returns the shape at the back of the z-order, and the expression ActiveDocument.Pages(1).Shapes(4) returns the shape at the front of the z-order.

Whenever you add a new shape to a collection, it is added to the front of the z-order by default.

To set the shape's position in the z-order, use the ZOrder method.

Example

This example adds an oval to the active publication, and then places the oval second from the back in the z-order if there is at least one other shape on the page.

Copy code Copy code
With ActiveDocument.Pages(1).Shapes _
 .AddShape(Type:=msoShapeOval, _
 Left:=100, Top:=100, Width:=100, Height:=300)
 Do While .ZOrderPosition > 2
 .ZOrder msoSendBackward
 Loop
End With


BorderArtFormat Properties (Publisher)

 Copy code hover
[image]

BorderArtFormat Properties (Publisher)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Color | Returns a ColorFormat object representing the color information for the specified object.
Exists | True if the specified BorderArtFormat object exists. Read-only Boolean.
Name | Returns or sets a String value indicating the name of the specified object. Read/write.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.
StretchPictures | True to stretch the picture art making up the specified BorderArt to fit the shape to which it is applied. Read/write Boolean. .
Weight | Returns or sets a Variant indicating the thickness of the specified line or cell border.


BorderArts.Application Property (Publisher)

 Copy code hover
[image]

BorderArts.Application Property (Publisher)
See also Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a BorderArts object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next

See also

Concepts

BorderArts Object

Other resources

BorderArts Object Members


Stories.Parent Property (Publisher)

 Copy code hover
[image]

Stories.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a Stories object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


Shape.TextFrame Property (Publisher)

 Copy code hover
[image]

Shape.TextFrame Property (Publisher)
Send feedback

Returns a TextFrame object that represents the text in a shape and the properties that control the margins and orientation of the text.

Syntax

expression .TextFrame

expression A variable that represents a Shape object.

Example

The following example adds text to the text frame of shape one in the active publication, and then formats the new text. This example assumes there is at least one shape on the first page of the active publication.

Copy code Copy code
Sub AddTextToTextFrame()
 With ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange
 .Text = "My Text"
 With .Font
 .Bold = msoTrue
 .Size = 25
 .Name = "Arial"
 End With
 End With
End Sub


ShadowFormat.IncrementOffsetY Method (Publisher)

 Copy code hover
[image]

ShadowFormat.IncrementOffsetY Method (Publisher)
Send feedback

Incrementally changes the vertical offset of the shadow by the specified distance.

Syntax

expression .IncrementOffsetY(Increment)

expression A variable that represents a ShadowFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Variant | Specifies how far the shadow offset is to be moved vertically. A positive value moves the shadow down; a negative value moves it up. Numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

Remarks

Use the OffsetY property to set the absolute vertical shadow offset.

Use the IncrementOffsetX method to change a shadow's horizontal offset.

Example

This example moves the shadow for the third shape in the active publication up by 3 points.

Copy code Copy code
ActiveDocument.Pages(1).Shapes(3).Shadow _
 .IncrementOffsetY Increment:=-3


PageSizes Members (Publisher)

 Copy code hover
[image]

PageSizes Members (Publisher)
Send feedback

Represents the collection of all PageSize objects in the parent Document object, where each PageSize object represents one of the page sizes available in the current Microsoft Publisher document.

Properties

Name | Description
Application | Returns an Application object that represents the creator of the parent PageSizes collection. Read-only.
Count | Returns the number of PageSize objects in the PageSizes collection of the active document. Read-only.
Item | Returns the PageSize object with the specified name or at the specified index position in the PageSizes collection. Read-only.
Parent | Returns the parent of the PageSizes collection. Read-only.


Document.Name Property (Publisher)

 Copy code hover
[image]

Document.Name Property (Publisher)
Send feedback

Returns a String value indicating the name of the specified object. Read-only.

Syntax

expression .Name

expression A variable that represents a Document object.

Remarks

You can use an object's name in conjunction with the Item method or Item property to return a reference to the object if the Item method or property for the collection that contains the object takes a Variant argument. For example, if the value of the Name property for a shape is Rectangle 2, then .Shapes("Rectangle 2") will return a reference to that shape.

The Name property is the default property for the BorderArt, BorderArtFormat, and Label objects.


Shapes.AddConnector Method (Publisher)

 Copy code hover
[image]

Shapes.AddConnector Method (Publisher)
Send feedback

Adds a new Shape object representing a connector to the specified Shapes collection.

Syntax

expression .AddConnector(Type, BeginX, BeginY, EndX, EndY)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | MsoConnectorType | The type of connector to add.
BeginX | Required | Variant | The x-coordinate of the beginning point of the connector.
BeginY | Required | Variant | The y-coordinate of the beginning point of the connector.
EndX | Required | Variant | The x-coordinate of the ending point of the connector.
EndY | Required | Variant | The y-coordinate of the ending point of the connector.

Return Value

Shape

Remarks

For the BeginX, BeginY, EndX, and EndY parameters, numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

The new connector isn't connected to any other shape; use the BeginConnect and EndConnect methods to connect the new connector to another shape.

The Type parameter can be one of these MsoConnectorType constants.

msoConnectorCurve | Adds a curved connector.
msoConnectorElbow | Adds an elbow-shaped connector.
msoConnectorStraight | Adds a straight-line connector.
msoConnectorTypeMixed | Not used with this method.

Example

The following example adds a new straight-line connector to the first page of the active publication.

Copy code Copy code
Dim shpConnect As Shape

Set shpConnect = ActiveDocument.Pages(1).Shapes.AddConnector _
 (Type:=msoConnectorStraight, _
 BeginX:=144, BeginY:=144, _
 EndX:=180, EndY:=72)


CalloutFormat.DropType Property (Publisher)

 Copy code hover
[image]

CalloutFormat.DropType Property (Publisher)
Send feedback

Returns an MsoCalloutDropType constant indicating where the callout line attaches to the callout text box. Read-only.

Syntax

expression .DropType

expression A variable that represents a CalloutFormat object.

Return Value

MsoCalloutDropType

Remarks

The DropType property value can be one of the MsoCalloutDropType constants declared in the Microsoft Office type library.

If the callout drop type is msoCalloutDropCustom, the values of the Drop and AutoAttach properties and the relative positions of the callout text box and callout line origin (where the callout points) are used to determine where the callout line attaches to the text box.

Use the PresetDrop method to set the value of this property.

Example

This example replaces the custom drop for the first shape in the active publication with one of two preset drops, depending on whether the custom drop value is greater than or less than half the height of the callout text box. For the example to work, the shape must be a callout.

VBA Copy code Copy code
With ActiveDocument.Pages(1).Shapes(1).Callout
 If .DropType = msoCalloutDropCustom Then
 If .Drop < .Parent.Height / 2 Then
 .PresetDrop DropType:=msoCalloutDropTop
 Else
 .PresetDrop DropType:=msoCalloutDropBottom
 End If
 End If
End With


Fields Object (Publisher)

 Copy code hover
[image]

Fields Object (Publisher)
Send feedback

A collection of Field objects that represent all the fields in a text range.

Remarks

The Count property for this collection in a publication returns the number of items in a specified shape or selection.

Example

Use the Fields property to return the Fields collection. Use Fields(index), where index is the index number, to return a single Field object. The index number represents the position of the field in the selection, range, or publication. The following example displays the field code and the result of the first field in each text box in the active publication.

Copy code Copy code
Sub ShowFieldCodes()
 Dim pagPage As Page
 Dim shpShape As Shape

 For Each pagPage In ActiveDocument.Pages
 For Each shpShape In pagPage.Shapes
 If shpShape.Type = pbTextFrame Then
 With shpShape.TextFrame.TextRange
 If .Fields.Count > 0 Then
 MsgBox "Code = " & .Fields(1).Code & vbLf _
 & "Result = " & .Fields(1).Result & vbLf
 End If
 End With
 End If
 Next
 Next
End Sub


CalloutFormat.Gap Property (Publisher)

 Copy code hover
[image]

CalloutFormat.Gap Property (Publisher)
Send feedback

Returns or sets a Variant indicating the horizontal distance between the end of the callout line and the text bounding box. Read/write.

Syntax

expression .Gap

expression A variable that represents a CalloutFormat object.

Return Value

Variant

Remarks

Numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

Example

This example sets the distance between the callout line and the text bounding box to 3 points for the first shape in the active publication. For the example to work, the shape must be a callout.

Copy code Copy code
ActiveDocument.Pages(1).Shapes(1).Callout.Gap = 3


PrintableRect Object (Publisher)

 Copy code hover
[image]

PrintableRect Object (Publisher)
Send feedback

Represents the sheet area within which the specified printer will print. The printable rectangle is determined by the printer based on the sheet size specified. The printable rectangle of the printer sheet should not be confused with the area within the margins of the publication page; it may be larger or smaller than the publication page.

Remarks

In cases in which the printer sheet and the publication page size are identical, the publication page is centered on the printer sheet and none of the printer's marks print, even if they are selected.

Example

Use the PrintableRect property of the AdvancedPrintOptions object to return a PrintableRect object. The following example returns printable rectangle boundaries for the printer sheet of the active publication.

Copy code Copy code
Sub ListPrintableRectBoundaries()

With ActiveDocument.AdvancedPrintOptions.PrintableRect

 Debug.Print "Printable area is " & _
 PointsToInches(.Width) & _
 " by " & PointsToInches(.Height) & " inches."
 Debug.Print "Left Boundary: " & PointsToInches(.Left) & _
 " inches (from left)."
 Debug.Print "Right Boundary: " & PointsToInches(.Left + .Width) & _
 " inches (from left)."
 Debug.Print "Top Boundary: " & PointsToInches(.Top) & _
 " inches(from top)."
 Debug.Print "Bottom Boundary: " & PointsToInches(.Top + .Height) & _
 " inches(from top)."

End With

End Sub


Row.Height Property (Publisher)

 Copy code hover
[image]

Row.Height Property (Publisher)
Send feedback

Returns or sets a Variant that represents the height (in points) of a specified table row or shape. Read/write.

Syntax

expression .Height

expression A variable that represents a Row object.

Remarks

The valid range for the Height property depends on the size of the application workspace and the position of the object within the workspace. For centered objects on non-banner page sizes, the Height property may be 0.0 to 50.0 inches. For centered objects on banner page sizes, the Height property may be 0.0 to 241.0 inches.

Example

This example creates a new table and sets the height and width of the second row and column, respectively.

VBA Copy code Copy code
Sub SetRowHeightColumnWidth()
 With ActiveDocument.Pages(1).Shapes.AddTable(NumRows:=3, _
 NumColumns:=3, Left:=80, Top:=80, Width:=400, Height:=12).Table
 .Rows(2).Height = 72
 .Columns(2).Width = 72
 End With
End Sub


DropCap.Parent Property (Publisher)

 Copy code hover
[image]

DropCap.Parent Property (Publisher)
Send feedback

Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.

Syntax

expression .Parent

expression A variable that represents a DropCap object.

Example

This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Copy code Copy code
Sub ParentObject()
 Dim shp As Shape
 Dim pg As Page

 Set pg = Selection.ShapeRange(1).Parent
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _
 Left:=72, Top:=72, Width:=72, Height:=72)

 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180)
End Sub

This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Copy code Copy code
Sub ParentShape()
 Dim shpParent As Shape
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent
 shpParent.Fill.Patterned Pattern:=msoPatternSphere
End Sub


ShapeRange.SoftEdge Property (Publisher)

 Copy code hover
[image]

ShapeRange.SoftEdge Property (Publisher)
See also Send feedback

Returns a SoftEdgeFormat object that represents the soft edge formatting for a range of shapes. Read-only.

Version Information

Version Added: Publisher 2013

Syntax

expression .SoftEdge

expression A variable that represents a ShapeRange object.

Return value

SOFTEDGEFORMAT

See also

Concepts

ShapeRange Object

Other resources

ShapeRange Object Members


ThreeDFormat.PresetExtrusionDirection Property (Publisher)

 Copy code hover
[image]

ThreeDFormat.PresetExtrusionDirection Property (Publisher)
Send feedback

Returns an MsoPresetExtrusionDirection constant that represents the direction taken by the extrusion's sweep path leading away from the extruded shape (the front face of the extrusion). Read-only.

Syntax

expression .PresetExtrusionDirection

expression A variable that represents a ThreeDFormat object.

Return Value

MsoPresetExtrusionDirection

Remarks

The PresetExtrusionDirection property value can be one of the MsoPresetExtrusionDirection constants declared in the Microsoft Office type library and shown in the following table.

msoExtrusionBottom

msoExtrusionBottomLeft

msoExtrusionBottomRight

msoExtrusionLeft

msoExtrusionNone

msoExtrusionRight

msoExtrusionTop

msoExtrusionTopLeft

msoExtrusionTopRight

msoPresetExtrusionDirectionMixed

This property is read-only. To set the value of this property, use the SetExtrusionDirection method.

Example

This example changes the extrusion for the first shape on the first page of the active publication if the extrusion extends toward the upper-left corner of the extrusion's front face. For this example to work, the specified shape must be a 3-D shape.

VBA Copy code Copy code
Sub SetExtrusion()
 With ActiveDocument.Pages(1).Shapes(1).ThreeD
 If .PresetExtrusionDirection = msoExtrusionTopLeft Then
 .SetExtrusionDirection msoExtrusionBottomRight
 End If
 End With
End Sub


PbVerticalPictureLocking Enumeration (Publisher)

 Copy code hover
[image]

PbVerticalPictureLocking Enumeration (Publisher)
Send feedback

Indicates where newly inserted pictures appear in relation to the specified frame.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbVerticalLockingBottom | 2 | New pictures are inserted along the bottom edge of the frame.
pbVerticalLockingNone | 0 | New pictures are inserted in the center between the top and bottom edges of the frame.
pbVerticalLockingStretch | 3 | New pictures are vertically stretched to the full height of the frame.
pbVerticalLockingTop | 1 | New pictures are inserted along the top edge of the frame.


FillFormat.UserTextured Method (Publisher)

 Copy code hover
[image]

FillFormat.UserTextured Method (Publisher)
Send feedback

Fills the specified shape with small tiles of an image.

Syntax

expression .UserTextured(TextureFile)

expression A variable that represents a FillFormat object.

Parameters

Name | Required/Optional | Data Type | Description
TextureFile | Required | String | The name of the texture file.

Remarks

To fill the shape with one large image, use the UserPicture method.

Example

This example adds two rectangles to the active publication. The rectangle on the left is filled with one large image of a picture; the rectangle on the right is filled with many small tiles of the same picture. (Note that PathToFile must be replaced with a valid file path for this example to work.)

Copy code Copy code
With ActiveDocument.Pages(1).Shapes
 .AddShape(Type:=msoShapeRectangle, _
 Left:=0, Top:=0, Width:=200, Height:=100).Fill _
 .UserPicture PictureFile:="PathToFile"
 .AddShape(Type:=msoShapeRectangle, _
 Left:=300, Top:=0, Width:=200, Height:=100).Fill _
 .UserTextured TextureFile:="PathToFile"
End With


PageSetup.Application Property (Publisher)

 Copy code hover
[image]

PageSetup.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a PageSetup object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Documents.Count Property (Publisher)

 Copy code hover
[image]

Documents.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a Documents object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


ShapeNodes Members (Publisher)

 Copy code hover
[image]

ShapeNodes Members (Publisher)
Send feedback

A collection of all the ShapeNode objects in the specified freeform. Each ShapeNode object represents either a node between segments in a freeform or a control point for a curved segment of a freeform. You can create a freeform manually or by using the BuildFreeform and ConvertToShape methods.

Methods

Name | Description
Delete | Deletes the specified shape node object.
Insert | Inserts a new segment after the specified node of the freeform drawing.
Item | Returns an individual object in a specified collection.
SetEditingType | Sets the editing type of the specified node. If the node is a control point for a curved segment, this method sets the editing type of the node adjacent to it that joins two segments. Depending on the editing type, this method may affect the position of adjacent nodes.
SetPosition | Sets the position of the specified node. Depending on the editing type of the node, this method may affect the position of adjacent nodes.
SetSegmentType | Sets the segment type of the segment that follows the specified node. If the node is a control point for a curved segment, this method sets the segment type for that curve; this may affect the total number of nodes by inserting or deleting adjacent nodes.

Properties

Name | Description
Application | Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.
Count | Returns a Long that represents the number of items in the specified collection.
Parent | Returns an object that represents the parent object of the specified object. For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. Read-only.


ShapeRange.InlineAlignment Property (Publisher)

 Copy code hover
[image]

ShapeRange.InlineAlignment Property (Publisher)
Send feedback

Returns or sets a PbInlineAlignment constant that indicates whether an inline shape has left, right, or in-text alignment. Read/write.

Syntax

expression .InlineAlignment

expression A variable that represents a ShapeRange object.

Remarks

The InlineAlignment property value can be one of the PbInlineAlignment constants declared in the Microsoft Publisher type library.

An automation error is returned if the shape is not already inline.

Example

The following example moves the second shape on the second page of the publication into the text flow by using the MoveIntoTextFlow method. The InlineAlignment property is then used to align the shape to the right.

VBA Copy code Copy code
Dim theShape As Shape
Dim theRange As TextRange

Set theRange = ActiveDocument.Pages(2).Shapes(1).TextFrame.TextRange
Set theShape = ActiveDocument.Pages(2).Shapes(2)

If Not theShape.IsInline = msoTrue Then
 theShape.MoveIntoTextFlow Range:=theRange
 theShape.InlineAlignment = pbInlineAlignmentRight
End If


MailMerge Methods (Publisher)

 Copy code hover
[image]

MailMerge Methods (Publisher)
Send feedback

This object has the following methods:

Methods

Name | Description
CreateShortcut | Creates a shortcut to the file that contains the list of recipients or products for a mail merge publication.
Execute | Performs the specified mail merge or catalog merge operation. Returns a Document object that represents the new or existing publication specified as the destination of the merge results. Returns Nothing if the merge is executed to a printer.
ExportRecipientList | Exports the list of mail-merge recipients to a Microsoft Office Access (.mdb) file or to a comma-delimited text (.csv) file.
OpenDataSource | Attaches a data source to the specified publication, which becomes a main publication if it is not one already.
ShowWizardEx | Displays the specified catalog or mail merge wizard in a document.


Shape.Fill Property (Publisher)

 Copy code hover
[image]

Shape.Fill Property (Publisher)
Send feedback

Returns a FillFormat object representing the fill for the specified shape or table cell.

Syntax

expression .Fill

expression A variable that represents a Shape object.

Example

This example creates a new AutoShape object and fills the shape with green.

VBA Copy code Copy code
Sub NewShapeItem()

 Dim shpHeart As Shape

 Set shpHeart = ThisDocument.MasterPages.Item(1).Shapes _
 .AddShape(Type:=msoShapeHeart, Left:=40, Top:=80, _
 Width:=50, Height:=50)
 shpHeart.Fill.ForeColor.RGB = RGB(Red:=0, Green:=255, Blue:=0)

End Sub


PbRecipientListFileType Enumeration (Publisher)

 Copy code hover
[image]

PbRecipientListFileType Enumeration (Publisher)
Send feedback

Constants passed to the MailMerge.ExportRecipientList method that specify the type of file in which to save an exported mail-merge recipient list.

Version Information

Version Added: Publisher 2007

Name | Value | Description
pbAsCsvFile | 1 | Save as comma-delimited CSV file.
pbAsMdbFile | 0 | Save as Microsoft Office Access MDB file.


PictureFormat.VerticalScale Property (Publisher)

 Copy code hover
[image]

PictureFormat.VerticalScale Property (Publisher)
Send feedback

Returns a Long that represents the scaling of the picture along its vertical axis. The scaling is expressed as a percentage (for example, 200 equals 200 percent scaling). Read-only.

Syntax

expression .VerticalScale

expression A variable that represents a PictureFormat object.

Return Value

Long

Remarks

The effective resolution of a picture is inversely proportional to the scaling at which the picture is printed. The larger the scaling, the lower the effective resolution. For example, suppose a picture measuring 4 inches by 4 inches was originally scanned at 300 dpi. If that picture is scaled to 2 inches by 2 inches, its effective resolution is 600 dpi.

Use the EffectiveResolution property of the PictureFormat object to determine the resolution at which the picture or OLE object prints in the specified document.

Example

The following example prints selected image properties for each picture in the active publication.

VBA Copy code Copy code
Dim pgLoop As Page
Dim shpLoop As Shape

For Each pgLoop In ActiveDocument.Pages
 For Each shpLoop In pgLoop.Shapes
 If shpLoop.Type = pbPicture Or shpLoop.Type = pbLinkedPicture Then

 With shpLoop.PictureFormat

 If .IsEmpty = msoFalse Then
 Debug.Print "File Name: " & .Filename
 Debug.Print "Resolution in Publication: " & .EffectiveResolution & " dpi"
 Debug.Print "Horizontal Scaling: " & .HorizontalScale & "%"
 Debug.Print "Height in publication: " & .Height & " points"
 Debug.Print "Vertical Scaling: " & .VerticalScale & "%"
 Debug.Print "Width in publication: " & .Width & " points"
 End If

 End With
 End If
 Next shpLoop
Next pgLoop


Hyperlink.Range Property (Publisher)

 Copy code hover
[image]

Hyperlink.Range Property (Publisher)
Send feedback

Returns a TextRange object representing the base text to which the specified hyperlink has been applied.

Syntax

expression .Range

expression A variable that represents a Hyperlink object.

Remarks

If the Type property of the specified Hyperlink object is a value other than msoHyperlinkRange, the Range property returns nothing.

Example

The following example returns the text range associated with the first hyperlink on page one of the active publication and changes the base text to "Go here."

VBA Copy code Copy code
Dim txtHyperlink As TextRange

txtHyperlink = ActiveDocument.Pages(1) _
 .Shapes(1).Hyperlink.Range

txtHyperlink.Text = "Go here"


Application.PointsToPicas Method (Publisher)

 Copy code hover
[image]

Application.PointsToPicas Method (Publisher)
See also Send feedback

Converts a measurement from points to picas (1 pica = 12 points). Returns the converted measurement as a Single.

Syntax

expression .PointsToPicas(Value)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Value | Required | Single | The point value to be converted to picas.

Return Value

Single

Remarks

Use the PicasToPoints method to convert measurements in picas to points.

Example

This example converts measurements in points entered by the user to measurements in picas.

Copy code Copy code
Dim strInput As String
Dim strOutput As String

Do While True
 ' Get input from user.
 strInput = InputBox( _
 Prompt:="Enter measurement in points (0 to cancel): ", _
 Default:="0")

 ' Exit the loop if user enters zero.
 If Val(strInput) = 0 Then Exit Do

 ' Evaluate and display result.
 strOutput = Trim(strInput) & " points = " _
 & Format(Application _
 .PointsToPicas(Value:=Val(strInput)), _
 "0.00") & " picas"

 MsgBox strOutput
Loop

See also

Concepts

Application Object

Other resources

Application Object Members


Selection.Application Property (Publisher)

 Copy code hover
[image]

Selection.Application Property (Publisher)
Send feedback

Used without an object qualifier, this property returns an Application object that represents the current instance of Publisher. Used with an object qualifier, this property returns an Application object that represents the creator of the specified object. When used with an OLE Automation object, it returns the object's application.

Syntax

expression .Application

expression A variable that represents a Selection object.

Example

This example displays the version and build information for Publisher.

VBA Copy code Copy code
With Application
 MsgBox "Current Publisher: version " _
 & .Version & " build " & .Build
End With

This example displays the name of the application that created each linked OLE object on page one of the active publication.

VBA Copy code Copy code
Dim shpOle As Shape

For Each shpOle In ActiveDocument.Pages(1).Shapes
 If shpOle.Type = pbLinkedOLEObject Then
 MsgBox shpOle.OLEFormat.Application.Name
 End If
Next


Table.TableDirection Property (Publisher)

 Copy code hover
[image]

Table.TableDirection Property (Publisher)
Send feedback

Returns or sets a PbTableDirectionType constant that represents whether text in a table is read from left to right or from right to left. Read/write.

Syntax

expression .TableDirection

expression A variable that represents a Table object.

Return Value

PbTableDirectionType

Remarks

The TableDirection property value can be one of the PbTableDirectionType constants declared in the Microsoft Publisher type library.

pbTableDirectionLeftToRight

pbTableDirectionRightToLeft

Example

This example enters a bold number into each cell in the specified table, and then sets the direction of the table so that the cells number from right to left. For this example to work, the specified shape must be a table.

VBA Copy code Copy code
Sub CountCellsByColumn()
 Dim tblTable As Table
 Dim rowTable As row
 Dim celTable As Cell
 Dim intCount As Integer

 Set tblTable = ActiveDocument.Pages(1).Shapes(1).Table

 'Loops through each row in the table
 For Each rowTable In tblTable.Rows

 'Loops through each cell in the row
 For Each celTable In rowTable.Cells
 With celTable.TextRange
 intCount = intCount + 1
 .Text = intCount
 .ParagraphFormat.Alignment = _
 pbParagraphAlignmentCenter
 .Font.Bold = msoTrue
 End With
 Next celTable
 Next rowTable
 tblTable.TableDirection = pbTableDirectionRightToLeft
End Sub


TextRange.InlineShapes Property (Publisher)

 Copy code hover
[image]

TextRange.InlineShapes Property (Publisher)
Send feedback

Returns an InlineShapes collection, which represents the inline shapes contained within a text range. Read-only.

Syntax

expression .InlineShapes

expression A variable that represents an TextRange object.

Return Value

InlineShapes

Remarks

Using TextFrame.Story.TextRange.InlineShapes will return all inline shapes in a text frame, including those that are in overflow. Using TextFrame.TextRange.InlineShapes will return only visible inline shapes in a text frame, and not those that are in overflow.

Example

The following example finds the first shape (a text box) on page one of the active publication. The InlineShapes property is then used to determine whether any inline shapes exist in the text box. If any are found, each inline shape is flipped vertically, and its fore color is set to red.

Note that by using TextFrame.Story.TextRange.InlineShapes, any inline shapes that are in overflow will also be found.

Copy code Copy code
Dim theShape As Shape
Dim i As Integer

Set theShape = ActiveDocument.Pages(1).Shapes(1)

With theShape.TextFrame.Story.TextRange
 If .InlineShapes.Count > 0 Then
 For i = 1 To .InlineShapes.Count
 .InlineShapes(i).Flip (msoFlipVertical)
 .InlineShapes(i).Fill.ForeColor.RGB = vbRed
 Next
 End If
End With


WebNavigationBarSets.Count Property (Publisher)

 Copy code hover
[image]

WebNavigationBarSets.Count Property (Publisher)
Send feedback

Returns a Long that represents the number of items in the specified collection.

Syntax

expression .Count

expression A variable that represents a WebNavigationBarSets object.

Example

This example displays the number of pages in the active document.

VBA Copy code Copy code
Sub CountNumberOfPages()
 MsgBox "Your publication contains " & _
 ActiveDocument.Pages.Count & " page(s)."
End Sub

This example displays the number of shapes in the active document.

Copy code Copy code
Sub CountNumberOfShapes()
 Dim intShapes As Integer
 Dim pg As Page

 For Each pg In ActiveDocument.Pages
 intShapes = intShapes + pg.Shapes.Count
 Next

 MsgBox "Your publication contains " & intShapes & " shape(s)."
End Sub


Application.Version Property (Publisher)

 Copy code hover
[image]

Application.Version Property (Publisher)
See also Send feedback

Returns a String indicating the version number of the currently-installed copy of Microsoft Publisher. Read-only.

Syntax

expression .Version

expression A variable that represents a Application object.

Return Value

String

Example

The following example displays the version and build number of the currently-installed copy of Publisher.

VBA Copy code Copy code
MsgBox "You are currently running Microsoft Publisher, " _
 & " version " & Application.Version & ", build " _
 & Application.Build & "."

See also

Concepts

Application Object

Other resources

Application Object Members